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?
team member room 7: mahnaz, Mohamad marshal, roqaya, huda
export default function Button() {
function handleClick() {
alert('You clicked me!');
}
return (
Click me
);
}
<button onClick={function handleClick() {
alert('You clicked me!');
}}>