Skip to content

Commit

Permalink
adding react router & setting up results page
Browse files Browse the repository at this point in the history
  • Loading branch information
sludovicdelys committed Apr 14, 2022
1 parent 7e907ec commit 80c0196
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 11 deletions.
61 changes: 61 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@testing-library/user-event": "^13.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.0",
"sass": "^1.49.9",
"web-vitals": "^2.1.4"
Expand Down
15 changes: 5 additions & 10 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Routes, Route } from 'react-router-dom';
import './assets/styles/app.scss';

import Categories from './data/categories.json';
Expand All @@ -10,16 +11,10 @@ console.log(Categories);
function App() {
return (
<div className="container">
<Form />
{
/* Categories.map( category => {
return(
<div className="box" key={ category.id }>
{ category.name }
</div>
)
}) */
}
<Routes>
<Route path="/" element={<Form />}/>
<Route path="/results" />
</Routes>
<Footer />
</div>
);
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
<React.StrictMode>
<App />
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>,
document.getElementById('root')
);
Expand Down

0 comments on commit 80c0196

Please sign in to comment.