Introduction to React

Props

If components resemble functions, properties resemble arguments to these functions. Properties, or short props, can be passed to components as arbitrary inputs and enable components to receive values from other components. Any component that creates subcomponents, can pass variables to its subcomponents via props. Props are used in many ways, for example, by passing text that the component should display, or booleans that decide if certain React elements are hidden or not. It is also possible to pass Javascript functions as props. This can be helpful to allow a child component to modify it’s parent component. More on that later. Note that props are read-only, i.e. they cannot be changed when passed to other components. Changing the props will re-render the respective component.