--- layout: docs title: InjectedComponentSet edit_url: "https://github.com/nylas/N1/blob/master/src/components/injected-component-set.cjsx" ---
InjectedComponent makes it easy to include a set of dynamically registered components inside of your React render method. Rather than explicitly render an array of buttons, for example, you can use InjectedComponentSet:
<InjectedComponentSet className="message-actions"
matching={role: 'ThreadActionButton'}
exposedProps={thread:@props.thread, message:@props.message}>
InjectedComponentSet will look up components registered for the location you provide,
render them inside a Flexbox and pass them exposedProps
. By default, all injected
children are rendered inside UnsafeComponent wrappers to prevent third-party code
from throwing exceptions that break React renders.
InjectedComponentSet monitors the ComponentRegistry for changes. If a new component is registered into the location you provide, InjectedComponentSet will re-render.
If no matching components is found, the InjectedComponent renders an empty span.
React props
supported by InjectedComponentSet:
matching |
Pass an Object with ComponentRegistry descriptors This set of descriptors is provided to ComponentRegistry::findComponentsForDescriptor to retrieve components for display. |
className |
Optional
A String class name for the containing element. |
children |
Optional
Any React elements rendered inside the InjectedComponentSet will always be displayed. |
exposedProps |
Optional
An Object with props that will be passed to each item rendered into the set. |
containersRequired |
Optional
. Pass false to optionally remove the containers placed around injected components to isolate them from the rest of the app. |
Any other props you provide, such as |