Props and States
React components can have a state object. The state object is where you store property values / data that belongs to the component. When the state object changes, the component re-renders / refreshes itself to show the new data. Props short for properties, is the optional input that your component can accept. Props are arguments passed into React components. It is passed to components via HTML attributes. It also allows the component content to be dynamic.
Loading video...
Props State - 1 (in Hindi)
Concepts
1

Props State - 1 (in Hindi)
2

Props State - 2 (in Hindi)
Watch the full video to earn 3
Quizzes
1
What's wrong with the code below? Select all that apply.
function Component() { const [count, setCount] = useState() setCount(count + 1) return <div>Counter value: {count}</div> }
Question 1 of 5
1
per question2
What will be the value of the count if the Increment button is clicked once?
function Component() { const [counter, setCounter] = React.useState(0); const handleClick = () => { setCounter(counter + 1); setCounter(counter + 1); } return ( <div style={{ textAlign: "center" }}> <p>Counter App</p> <p>Counter Value: {counter}</p> <button onClick={handleClick}>Increment</button> </div> ); }
Question 1 of 5
1
per question3
Using which keyword
I can set default props?
Question 1 of 5
1
per question4
Which of the following is used to pass data to a component from outside in React.js?
Question 1 of 5
1
per question5
State update using useState
is asynchronous in nature.
Question 1 of 5
1
per question