Closed sahaam closed 6 years ago
Yeah, us using stage 3 will include all plugins from stage 3 and higher. ie. >= 3
The stages map to TC39 stages where lower numbers are very early stage through the process and stage 3/4 are basically accepted. You can read more about that here: https://tc39.github.io/process-document/
You will have to extend your babel config using the provided mechanisms within the config file in order to support your required needs.
I do warn against using anything below stage 3. Even stage 3 is a risk, but I think below stage 3 is significantly more risky to use. See what happened to the decorators syntax. :)
Hi,
I am not able to use class properties such as
`class TempComponent extends React.Component { state = { open: false, };
handleDrawerOpen = () => { this.setState({ open: true }); };`
Getting the following error
`{ BabelLoaderError: SyntaxError: Unexpected token (98:8)
96 | 97 | class TempComponent extends React.Component {
name: 'BabelLoaderError', message: 'SyntaxError: Unexpected token (98:8)\n\n\u001b[0m \u001b[90m 96 | \u001b[39m\n \u001b[90m 97 | \u001b[39m\u001b[36mclass\u001b[39m \u001b[33mTempComponent\u001b[39m \u001b[36mextends\u001b[39m \u001b[33mReact\u001b[39m\u001b[33m.\u001b[39m\u001b[33mComponent\u001b[39m {\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 98 | \u001b[39m state \u001b[33m=\u001b[39m {\n \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 99 | \u001b[39m open\u001b[33m:\u001b[39m \u001b[36mfalse\u001b[39m\u001b[33m,\u001b[39m\n \u001b[90m 100 | \u001b[39m }\u001b[33m;\u001b[39m\n \u001b[90m 101 | \u001b[39m\u001b[0m\n', hideStack: true, error: { SyntaxError: /Users/sahaam/Desktop/workspace/mygit/react-universally/shared/components/DemoApp/AsyncAboutRoute/AboutRoute.js: Unexpected token (98:8)`
I see we are using babel-preset-stage-3, this class property transform is provided as part of Babel's stage 2 preset. But why is this issue then