-1

I'm learning react-redux app and now I'm trying to pass to th browser a "Hello World!" but when I start it with npm it appears an error and I don't really know how to fix it. Sorry I'm a bit noob in this coding world. npm

package.json

webpack.config

Thanks in advance :)


Edit:

Below is my index.js code:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/app';
ReactDOM.render( <App />, document.getElementById('app') );

Below is my app.js code:

import React from 'react'; export default () => ( <div>Hello world!</div> );

module.export = {
  entry: './index.js',
  output: {
    path: __dirname,
    filename:'bungle.js'
  },
  devtool: 'eval-source-map',
  module: {
    loaders: [{
      test: /.js?$/,
      loader: 'babel-loader',
      exclude: /node_modules/,
      query: {
        presets: ['es2015', 'react'],
        plugins: ['transform-object-rest-spread']
      }
    }] 
  } 
};
RobC
  • 16,905
  • 14
  • 51
  • 62
Za Fra
  • 13
  • 7

1 Answers1

0

Is the src folder in the root of the project or did you try to move it?

Although React officialy doesn't follow a specific folder structure and naming convention but its very common that developers normally place most of the logic inside src folder. Source folder can have a components folder where u store all folders, similarly inside the src folder you can have an images folder to store all the images , a css folder to store all the css and so on. You are right by default you get a src folder through creat react app. I guess the teacher you are following might create a src folder in the future or you can show me the code of your index file so i can tell u better


Edit: (after OP provided index.js and app.js)

That's strange. Although this shouldn't happen but what I'll recommend is to create another react project through create-react-app and try to run that to see if this is not some issue with React

RobC
  • 16,905
  • 14
  • 51
  • 62
Willy wonka
  • 129
  • 4