javascript - React Router: Target container is not a DOM element -
i getting error while following react router tutorial here , here
it should work it's supposed do, because in index.html have added "app" id in div container.
_registercomponent(...): target container not dom element. ./src/index.js src/index.js:15
here index.js
import react 'react'; import reactdom 'react-dom'; import './index.css'; import app './app'; import registerserviceworker './registerserviceworker'; import './modules/about' import repos './modules/repos' import { browserrouter router, route, link } 'react-router-dom' reactdom.render(( <router> <div> <ul> <li><link to="/">home</link></li> <li><link to="/about">about</link></li> <li><link to="/topics">topics</link></li> </ul> <hr/> <app /> <route exact path="/" component={app}/> <route path="/repos" component={repos}/> <route path="/about" component={about}/> </div> </router> ), document.getelementbyid('app'));
index.html
<!doctype html> <html> <head> <title>my first react router app</title> </head> <body> <div id="app"></div> <script src="bundle.js"></script> </body> </html>
Comments
Post a Comment