Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf3fc26
commit b104681
Showing
5 changed files
with
68 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,36 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App' | ||
import './index.css' | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import { createBrowserRouter, RouterProvider } from "react-router-dom"; | ||
import App from "./App"; | ||
import "./index.css"; | ||
import Comments from "./routes/comments"; | ||
import Movies from "./routes/movies"; | ||
import Profile from "./routes/profile"; | ||
import Root from "./routes/root"; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')).render( | ||
const router = createBrowserRouter([ | ||
{ | ||
path: "/", | ||
element: <Root />, | ||
children: [ | ||
{ | ||
path: "movies", | ||
element: <Movies />, | ||
}, | ||
{ | ||
path: "comments", | ||
element: <Comments />, | ||
}, | ||
{ | ||
path: "profile", | ||
element: <Profile />, | ||
}, | ||
], | ||
}, | ||
]); | ||
|
||
ReactDOM.createRoot(document.getElementById("root")).render( | ||
<React.StrictMode> | ||
<App /> | ||
<RouterProvider router={router} /> | ||
</React.StrictMode> | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Comments() { | ||
return ( | ||
<> | ||
<h2>Comments</h2> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Movies() { | ||
return ( | ||
<> | ||
<h2>Movies</h2> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Profile() { | ||
return ( | ||
<> | ||
<h2>My Profile</h2> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Outlet } from "react-router"; | ||
|
||
export default function Root() { | ||
return ( | ||
<> | ||
<div id="header"> | ||
<h1>React Movies</h1> | ||
</div> | ||
<div id="detail"> | ||
<Outlet /> | ||
</div> | ||
</> | ||
); | ||
} |