How do you say that props are read only?

Posted by Editorial Staff | Updated on

How do you say that props are read only?

When you declare a component as a function or a class, it must never modify its own props.

Let us take a below capital function,

The above function is called “pure” because it does not attempt to change their inputs, and always return the same result for the same inputs. Hence, React has a single rule saying “All React components must act like pure functions with respect to their props.”

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers