Skip to content

Commit

Permalink
Added basic routing for home and courses
Browse files Browse the repository at this point in the history
  • Loading branch information
avicndugu committed Aug 18, 2022
1 parent 61b3335 commit 30086be
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 9 deletions.
68 changes: 61 additions & 7 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0"
}
}
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// @ts-nocheck
import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from 'react-router-dom';
import "./css/index.css";
import Main from "./main";
let root = ReactDOM.createRoot(document.querySelector("#root"));
root.render(
<React.StrictMode>
<Main />
<BrowserRouter>
<Main />
</BrowserRouter>
</React.StrictMode>
);
17 changes: 17 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
//@ts-nocheck
import React from "react";
import { Routes, Route, Link } from 'react-router-dom';

export default function Main(props) {
return (
<>
<p>gamed</p>
<ul>
<li>
<Link to="/html">HTML</Link>
</li>
<li>
<Link to="/css">CSS</Link>
</li>
<li>
<Link to="/javascript">Javascript</Link>
</li>
</ul>
<Routes>
<Route exact path="/" element={ <p>Home</p> } />
<Route path="/:course" element={ <p>Course</p> } />
</Routes>
</>
);
}
Empty file added src/pages/Course.jsx
Empty file.
Empty file added src/pages/Home.jsx
Empty file.

0 comments on commit 30086be

Please sign in to comment.