It seems like they should be since props should never be changed within the component. I can't find any answers on Google or Stack Overflow so asking here just to be sure.
It's not a Typescript specificity but a React one.
React is design to render component according a set of props. If you want to change the way a component is render the parent need to generate new props and give it to the children.
The React data flow is a one-way flow from parents to children. You can't and you don't want to mutate a props coming from a parents. Because if props can be mutated it should produce UI issues with React component life cycle. A component re-render only if the reference of one of his props change. Mutate a props will not re-render component and your UI will be different from your data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With