API for extending React components. The main function is
extendComponent, a simple higher order function / component which allows people to extend a component in one of the following ways:
insertBeforeComponentallows you to insert a component before the extensible component.
insertAfterComponentallows you to insert a component after the extensible component.
replaceComponentallows you to replace the extensible component with your own component.
removeComponentallows you to remove the extensible component.
Please take a look at index.js to see how simple it is to implement this.
- When a component is removed, we can render a nullComponent in its place, showing what was removed and by who.
- When a component gets replaced, we can ensure it is replaced by something with the same type, for example
- [Not included in PoC] We could ensure a component only gets replaced with a component that has the same interface in terms of props. For example, we could decide we want props required by the extensible component to also be required by the replacement component. React makes this easy.