I am doing this Router tutorial.
My App.jsx file:
import React from \'react\';
import ReactDOM from \'react-dom\';
import { Router, Route, Link, browserH
1) install "npm install --save react-router-dom" with this command. 2) Know modify your App.jsx like this
import React from 'react';
import { Switch, Route, Link} from 'react-router-dom';
class App extends React.Component {
render() {
return (
);
}
}
class Header extends React.Component {
render() {
return (
);
}
}
class Content extends React.Component {
render() {
return (
);
}
}
class Home extends React.Component {
render() {
return (
Home...
);
}
}
class About extends React.Component {
render() {
return (
About...
);
}
}
class Contact extends React.Component {
render() {
return (
Contact...
);
}
}
export default App;
4) modify your main.js like this
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';
import {HashRouter} from 'react-router-dom';
ReactDOM.render((
), document.getElementById('app'))