Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ComponentOne from '../components/component-one'
- import ComponentTwo from '../components/component-two'
- class Home extends Component {
- constructor( props ) {
- // So I can dynamically call a Component, found no other way
- this.components = {
- ComponentOne: <ComponentOne />,
- ComponentTwo: <ComponentTwo />
- }
- }
- [...code removed for brevity...]
- _appendStep( step ) {
- var component = React.cloneElement(this.components[step])
- this.steps.appendChild( component )
- }
- }
- <div className="recipe-steps" ref={(ref) => this.steps = ref}></div>
- var basicElement = document.createElement('h1')
- basicElement.innerHTML = "This works, but I need a component to work too"
- this.steps.appendChild( basicElement )
- Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement