InterviewHubPRO
Section Overview
Q188

Question 188 of 445

Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

42%
React & Modern Frontend (445 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

How do you say that props are readonly?

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,

javascript
function capital(amount, interest) {
return amount + interest;
}

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."