**actual code**
Const swimmingName = 'sports-basketball' + (this.props.jumping ? ' jumping' : '');
**converted code**
let swimmingName = classnames({
'sports-basketball' : true,
'jumping' : this.props.jumping
});
Uncaught ReferenceError: classnames is not defined
at PlayingSinging.render (swimming.jsx:20)
at PlayingSinging.<anonymous> (makeAssimilatePrototype.js:15)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:587)
at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:607)
at ReactCompositeComponentWrapper.wrapper [as _renderValidatedComponent] (ReactPerf.js:66)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:220)
at ReactCompositeComponentWrapper.wrapper [as mountComponent] (ReactPerf.js:66)
at Object.mountComponent (ReactReconciler.js:37)
at ReactDOMComponent.mountChildren (ReactMultiChild.js:241)
at ReactDOMComponent._createContentMarkup (ReactDOMComponent.js:591)
答案 0 :(得分:0)
我认为你没有导入类名,所以你可以试试这个
import classnames from 'classnames'
let swimmingName = classnames({
'sports-basketball' : true,
'jumping' : this.props.jumping ? true : false
});