React props & state
Props
. Props, short for “properties,”
. fundamental concept in React for passing data from a parent component to its child components.
. They enable the dynamic rendering of content and promote component reusability
. Props are read-only, meaning a child component cannot modify the data it receives from its parent.
Get Sri Paakes’s stories in your inbox
Join Medium for free to get updates from this writer.
. Props can be passed as attributes when rendering a component.
state
. State in React refers to a component’s internal data that can change over time.
. It is a plain JavaScript object managed within the component, influencing the rendering output.
. Whenever the state changes, React re-renders the component, reflecting the updated data in the UI.
. State is specific to each component instance, and it’s the primary way to create dynamic and interactive user interfaces in React.
To declare a state variable, the useState Hook is used in functional components. It returns an array containing the current state value and a function to update it.







