In this recipe, you will build a component that that renders one of its children according to a given condition. Firstly, create a new package.json file with the following content:
{ "scripts": { "start": "parcel serve -p 1337 index.html" }, "devDependencies": { "babel-plugin-transform-class-properties": "6.24.1", "babel-preset-env": "1.6.1", "babel-preset-react": "6.24.1", "babel-core": "6.26.3", "parcel-bundler": "1.8.1", "react": "16.3.2", "react-dom": "16.3.2" } }
Next, create a babel configuration file as .babelrc, adding the following content:
{ "presets": ["env","react"], "plugins": ["transform-class-properties"] }
Then, install the dependencies by opening a Terminal and running:
npm install