Quick Tip – Transclusion in React

Wednesday, March 23, 2016

Yesterday I created a complex React menu component that needed to host another component. In order to do the same behavior in Angular v1 you would have probably used transclusion. In React in order to host a child/ren component inside a host parent component you can use the props.children property. The following example shows a simple component that exposes the option to host other components: export class ExampleComponent extends Component { render() { function createItem(item) { return...
no comments