Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react'
- const withClass = (Component, classes) => {
- return ({...props}) =>
- <div className={classes}>
- <Component {...props}/>
- </div>
- }
- export default withClass
- // import React from 'react'
- // export default (WrappedComponent, classes) => {
- // return ({ ...props} ) =>
- // <div className={classes}> <WrappedComponent {...props } /> </div>
- // }
- //// ДОЧЕРНИЙ ЭЛЕМЕНТ
- ...
- return (
- <React.Fragment>
- <h3>Car name: {this.props.name}</h3>
- <p>Year <strong>{this.props.year}</strong></p>
- <input
- type="text"
- value={this.props.name}
- onChange={this.props.onChangeName}
- />
- </React.Fragment>
- );
- }
- }
- export default withClass(Car, classes.car)
Add Comment
Please, Sign In to add comment