Switch component to render React component like switch statement based on object path availability
import{Switch,Case,Default}from'react-switch-path';constobj={propB: {propC: {id: 123}}};constapp=(<Switchobject={obj}><Casepath='propA'component={ComponentA}/><Casepath='propB'component={ComponentB}><Casepath='propC'component={ComponentC}/></Case><Defaultcomponent={ComponentD}/></Switch>);render(app,document.getElementById('app'));Above will render ComponentB with ComponentC passed as children props of ComponentB. Also ComponentC will receive {id: 123} as it's props.