After concluding two courses on React on Codecademy, I then followed instruction downloading Babel and Webpack, and tediously wrote out the package.json. Long story short, the package.json was filled with errors that npm caught when I tried to start it.
I couldn’t make it work so I tried something else, I download a “create-react-app” from something called facebook incubator. That worked OK, put up a dev server and ran its app. So I tried to transfer its methodology to my first app. But it is different. It does not use Webpack! It uses something called react-scripts, and you have to require that, and somehow a service worker file is in there someplace.
I replaced the webpack parts of my package.json file with the good parts from the create-react-app and react-scripts. I then imported react-scripts under the imports for react and react-dom in my app. Like this:
{
"name": "jackproject1",
"version": "1.0.0",
"description": "Jack's first project",
"main": "index.js",
"scripts": {
"build": "webpack",
"author": "",
"license": "ISC"
},
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-scripts": "1.0.10"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-react": "^6.24.1"
}
}
But it still does not work. When I type “npm start”, I still just get ERR ERR ERR ERR ERR ERR
and now I have lost the plot altogether. I don’t know what to do.
Is this the part where React saves us all time and effort? If this were a live production situation, it would be faster for me to use vanilla JS by hand.
I need a SIMPLE way of running React components I build,otherwise I won’t use it.