React · Junior · Question 8 of 75

Can you modify props inside a child component?

Explanation

Props are the component's inputs, and it must not mutate them. For a child to change data, the parent passes it a callback (onChange) and keeps the state itself. Mutating an object from props won't trigger a re-render and creates hard-to-find bugs.

Further reading

Problem with a question

React · Junior · question 8

Test yourself

Take the React · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz