Babel preset for all React plugins.
> Babel preset for all React plugins.
This preset includes the following plugins/presets:
- preset-flow
- syntax-jsx
- transform-react-jsx
- transform-react-display-name
> You can also check out the React Getting Started page
> For more info, check out the setup page on the cli and the usage docs.
Install the CLI and this preset
``sh`
npm install --save-dev babel-cli babel-preset-react
Make a .babelrc config file with the preset
`sh`
echo '{ "presets": ["react"] }' > .babelrc
Create a file to run on
`sh`
echo 'Hello, world!
' > index.js
View the output
`sh`
./node_modules/.bin/babel index.js
.babelrc
`json`
{
"presets": ["react"]
}
`sh`
babel script.js --presets react
`javascript``
require("babel-core").transform("code", {
presets: ["react"]
});