diff --git a/react-router/rotas/.gitignore b/react-router/rotas/.gitignore index d30f40e..bb5f2bb 100644 --- a/react-router/rotas/.gitignore +++ b/react-router/rotas/.gitignore @@ -19,3 +19,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +yarn.lock diff --git a/react-router/rotas/package.json b/react-router/rotas/package.json index 09a34c9..64b10b6 100644 --- a/react-router/rotas/package.json +++ b/react-router/rotas/package.json @@ -5,7 +5,7 @@ "dependencies": { "react": "^15.5.4", "react-dom": "^15.5.4", - "react-router": "^3.0.5" + "react-router-dom": "^4.2.2" }, "devDependencies": { "react-scripts": "1.0.7" diff --git a/react-router/rotas/src/index.js b/react-router/rotas/src/index.js index 52f745f..7960e73 100644 --- a/react-router/rotas/src/index.js +++ b/react-router/rotas/src/index.js @@ -4,9 +4,5 @@ import App from './pages/App'; import registerServiceWorker from './registerServiceWorker'; import './index.css'; -import { Router, Route, hashHistory } from 'react-router'; - -ReactDOM.render(( -), - document.getElementById('root')); +ReactDOM.render(, document.getElementById('root')); registerServiceWorker(); \ No newline at end of file diff --git a/react-router/rotas/src/pages/App.js b/react-router/rotas/src/pages/App.js index 929f1cf..a2ddec8 100644 --- a/react-router/rotas/src/pages/App.js +++ b/react-router/rotas/src/pages/App.js @@ -1,12 +1,26 @@ import React, { Component } from 'react'; +import { BrowserRouter as Router, Route, Switch, Link } from 'react-router-dom' import logo from './logo.svg'; import './App.css'; +import Home from './home' +import About from './about' + class App extends Component { render() { return ( -

Mostrando component

- ); + +
+ Home + About + + + + + +
+
+ ) } } diff --git a/react-router/rotas/src/pages/about.js b/react-router/rotas/src/pages/about.js new file mode 100644 index 0000000..5e709a2 --- /dev/null +++ b/react-router/rotas/src/pages/about.js @@ -0,0 +1,7 @@ +import React from 'react' + +const About = () => ( +

About

+) + +export default About \ No newline at end of file diff --git a/react-router/rotas/src/pages/home.js b/react-router/rotas/src/pages/home.js new file mode 100644 index 0000000..175ea98 --- /dev/null +++ b/react-router/rotas/src/pages/home.js @@ -0,0 +1,7 @@ +import React from 'react' + +const Home = () => ( +

Home

+) + +export default Home \ No newline at end of file