Props (a.k.a. properties) are used in React to pass in attributes to your components when you declare them in the JSX.
Our Box from the last lesson is our component that returns a
JSX.Element describing a
But we cannot modify any of its properties when we create it, so if we create 2 or more, then they will just be placed in the scene on top of each other in the same position.
Instead, we can add
props that we will use to further initialize them with a position when we declare them in the JSX.
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9 10 11
Note that React will re-render any component instances whenever a change is made to its state or props.
|Components and Props||reactjs.org||codesandbox.io|
git clone https://github.com/Sean-Bradley/React-Three-Fiber-Boilerplate.git cd React-Three-Fiber-Boilerplate git checkout props npm install npm start