Please discuss with your teams and answer these questions in your own words.
- What is the difference between state and props in React?
- When should you use state and props in React?
- What is the difference between stateful and stateless components in React?
- How can you pass props to a component in React?
- How does react handle events, can you write an example?
Room 8 (Noor Ridha Ramyar Nanor Baraa and Mohammed othman
1.state is like a local variable can not be accessed or modified outside of the component
props make components reusable by giving components the ability to receive data from their parent component in the form of props.
2.Props is short for properties and they are used to pass data between React components.React has another special built-in object called state, which allows components to create and manage their own data. Data from props is read-only, and cannot be modified by a component that is receiving it from outside. State data can be modified by its own component, but is private (cannot be accessed from outside)
3.for stateful :
for stateless:
5.5.React events are named using camelCase, rather than lowercase for example
Activate Lasers