InjectedComponent
Summary
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.
Class Properties
propTypes
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. |
| onComponentDidRender | Optional Callback that will be called when the injected component is successfully rendered onto the DOM. |
| 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. |
| fallback | Optional A {Component} to default to in case there are no matching components in the ComponentRegistry |
| requiredMethods | (options) An {Array} with a list of methods that should be implemented by the registered component instance. If these are not implemented, an error will be thrown. |