Advertisement
Guest User

Untitled

a guest
May 4th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import ComponentOne from '../components/component-one'
  2. import ComponentTwo from '../components/component-two'
  3.  
  4. class Home extends Component {
  5. constructor( props ) {
  6. // So I can dynamically call a Component, found no other way
  7. this.components = {
  8. ComponentOne: <ComponentOne />,
  9. ComponentTwo: <ComponentTwo />
  10. }
  11. }
  12.  
  13. [...code removed for brevity...]
  14.  
  15. _appendStep( step ) {
  16. var component = React.cloneElement(this.components[step])
  17. this.steps.appendChild( component )
  18. }
  19. }
  20.  
  21. <div className="recipe-steps" ref={(ref) => this.steps = ref}></div>
  22.  
  23. var basicElement = document.createElement('h1')
  24. basicElement.innerHTML = "This works, but I need a component to work too"
  25. this.steps.appendChild( basicElement )
  26.  
  27. 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