tj / frontend-boilerplate

webpack-react-redux-babel-autoprefixer-hmr-postcss-css-modules-rucksack-boilerplate (unmaintained, I don't use it anymore)
2.93k stars 268 forks source link

An error about classnames #92

Closed wss534857356 closed 7 years ago

wss534857356 commented 7 years ago
// client/components/TodoItem/index.js
const classes = classnames({
      [style.completed]: todo.completed,
      [style.normal]: !this.state.editing,
      [style.editing]: this.state.editing
 })
// style.editing will be 'editing___[hash:base64:5] normol___[hash:base64:5]'

If you encounter the same mistake, you may try the following way:

// client/components/TodoItem/index.js
const classBind = classnames.bind(style)
const classes = classBind({
  completed: todo.completed,
  normal: !this.state.editing,
  editing: this.state.editing
})
// now editing will be 'editing___[hash:base64:5]'

I don't know how this error is triggered, but it looks like the postcss error