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?
Nma, Hala, Noor, Riham, Rozhyar
- states can be asynchronous function and it can be changed, but Props read only similar to parameters in functions.
- the utilization of props is to pass data and the states is used to manage the data.
- the stateless component doesn't store data similar to a calculator that always starts from zero. however stateful component stores data similar to our computer terminal; while we type something for the second time it will auto complete the rest as it stored before, without us finishing it.
- it has to be written inside JSX file, and has to be passed inside Avatar function.
- the event name is camelCased and it's written inside the JSX file like the following example:
Submit