how to import component in index.js in react.js

R

ReactScripter

Guest
I have created component folder in src folder and tried to write simple greeting program for that I have created 3 files:

  1. GreetUser.jsx
  2. index.jsx
  3. index.html

while compiling it is showing that could not find required index.js file.

I have written 3 files in Component folder and have imported GreetingUser module in the index.jsx file and while compiling it is showing that could not find required index.js file.

1.GreetingUser.jsx

import React , {component} from 'react';
class GreetUser extends component
{
render()
{
return <h1>Greetings from suraj!!!!</h1>;
}
}
export default GreetUser;


2.index.jsx

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
import * as serviceWorker from './serviceWorker';

import GreetUser from './Component/GreetUser.jsx';


ReactDOM.render(<GreetUser/>,document.getElementById('aaa'));


serviceWorker.unregister();

Could not find a required file. Name: index.js
Continue reading...
 
Top