0

I have created one other component with the name of counter and imported into the index.js but while registering the service worker; it says " Attempted import error: './serviceWorker' does not contain a default export (imported as 'registerServiceWorker')."

so i am trying to learn react for my new project through new videos on youtube but while implementing the react i found this error and i am feeling stucked


import  React from 'react';
import ReactDOM from 'react-dom';
import './index.css';

import App from './App';

import registerServiceWorker from './serviceWorker';

import 'bootstrap/dist/css/bootstrap.css';

import Counter from './components/counter';


ReactDOM.render(<Counter/>. document.getElementById("root"));

export default registerServiceWorker;


import React, { Component } from 'react';

export default class Counter extends Component{
    state={}

    render(){

//        React.createElement
        return <h1>Hello Worlds</h1>
    }

}
Kishor Pant
  • 136
  • 1
  • 4
  • 1
    Why are you importing it just to export it again? Have you tried `import { register } from './serviceWorker';`? – Tholle Apr 15 '19 at 17:17
  • Possible duplicate of https://stackoverflow.com/questions/55858569/create-react-app-shows-serviceworker-js-and-not-the-registerserviceworker-that-a/55868413#55868413 (which was asked later actually) – Darshak Parikh Apr 27 '19 at 15:21

0 Answers0