Search code examples
reactjscreate-react-app

Can I add the preset/plugin for double colon operator in create-react-app?


I'm looking for a way but I can't find how do I add a preset or plugin for babel to transpile the bind operator.

Can I do this (and how), or you can't modify configuration on create-react-app?


Solution

  • There is a transform-function-bind Babel plugin. However, create-react-app does not let you modify the underlying Babel configuration, so you would have to npm run eject (which is generally not recommended because you'd be losing the ability to update react-scripts). I would recommend ignoring this feature if you don't need it, and you may want to consider not using create-react-app (or ejecting) if you find it necessary.