--- layout: docs title: InjectedComponent edit_url: "https://github.com/nylas/N1/blob/master/src/components/injected-component.cjsx" ---
InjectedComponent makes it easy to include dynamically registered
components inside of your React render method. Rather than explicitly render
a component, such as a <Composer>
, you can use InjectedComponent:
<InjectedComponent matching={role:"Composer"} exposedProps={draftClientId:123} />
InjectedComponent will look up the component registered with that role in the
ComponentRegistry and render it, passing the exposedProps (draftClientId={123}
) along.
InjectedComponent monitors the ComponentRegistry for changes. If a new component is registered that matches the descriptor you provide, InjectedComponent will refresh.
If no matching component is found, the InjectedComponent renders an empty div.
React props
supported by InjectedComponent:
matching |
Pass an Object with ComponentRegistry descriptors. This set of descriptors is provided to ComponentRegistry::findComponentsForDescriptor to retrieve the component that will be displayed. |
className |
Optional
A String class name for the containing element. |
exposedProps |
Optional
An Object with props that will be passed to each item rendered into the set. |