How do you provide default props for nested shape in React?

Posted by Rohit Kumar | Updated on

In this example, I have shared how do you provide default props for nested shape in React? However, one approach might be to have a Child component for each item. That way each Child component receives one object from the item array, and then the default props will be merged as you expect.

For example:


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

Related Questions & Answers