opendevs
Components

Props and States

Loading video...

Props State - 1 (in Hindi)

Concepts

    1

    Props State - 1 (in Hindi)
    Props State - 1 (in Hindi)

    2

    Props State - 2 (in Hindi)
    Props State - 2 (in Hindi)
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.Finish watching the concept videos to earn    DevCoin image  each
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
2

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
3

Using which keyword I can set default props?


Question 1 of 5
4

Which of the following is used to pass data to a component from outside in React.js?


Question 1 of 5
5

State update using useState is asynchronous in nature.


Question 1 of 5
Practice Problems
StatusTitleDifficultyDevCoin image

easy

medium

easy

Copyright © 2022 opendevs

Learn ● Develop ● Ace
All illustrations by Storyset