Guest User

Untitled

a guest
Oct 15th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import React from 'react'
  2.  
  3. const withClass = (Component, classes) => {
  4. return ({...props}) =>
  5. <div className={classes}>
  6. <Component {...props}/>
  7. </div>
  8. }
  9.  
  10. export default withClass
  11.  
  12. // import React from 'react'
  13.  
  14. // export default (WrappedComponent, classes) => {
  15. // return ({ ...props} ) =>
  16. // <div className={classes}> <WrappedComponent {...props } /> </div>
  17. // }
  18.  
  19.  
  20.  
  21. //// ДОЧЕРНИЙ ЭЛЕМЕНТ
  22. ...
  23. return (
  24. <React.Fragment>
  25. <h3>Car name: {this.props.name}</h3>
  26. <p>Year <strong>{this.props.year}</strong></p>
  27. <input
  28. type="text"
  29. value={this.props.name}
  30. onChange={this.props.onChangeName}
  31. />
  32. </React.Fragment>
  33. );
  34. }
  35. }
  36.  
  37.  
  38. export default withClass(Car, classes.car)
Add Comment
Please, Sign In to add comment