react-color
react-color copied to clipboard
Uncaught TypeError: Cannot read property 'isValidHex' of undefined
When using with webpack since 2.19.3 it breaks when:
import color from 'react-color/lib/helpers/color'
... then in code use:
color.isValidHex(data.hex)
causes error.
I guess it is because in color.js there are:
exports.isvalidColorString = exports.red = exports.getContrastingColor = exports.isValidHex = exports.toState = exports.simpleCheckForValidColor = undefined;
Ok I see now you have explicitly import exact method like:
import { isValidHex } from 'react-color/lib/helpers/color'
Thanks.