Using Components as Templates in React JS

By using components as templates we can save our time developing a same UI or functionality multiple times. By placing the part of UI, which is similar for all the elements in one separate component and then enclosing all the components which will use the logic inside the opening and closing tag.

We can get the elements inside the opening and closing tag of a component using props.children property.

Leave a Reply

Your email address will not be published. Required fields are marked *