Commit b654d2bf authored by Balasuriya D.A.M.'s avatar Balasuriya D.A.M.

React Router Dom Test

parent d2363674
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "frontend", "name": "frontend",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"proxy":"http://127.0.0.1:5000", "proxy": "http://127.0.0.1:5000",
"dependencies": { "dependencies": {
"@chakra-ui/react": "^1.8.8", "@chakra-ui/react": "^1.8.8",
"@emotion/react": "^11.9.0", "@emotion/react": "^11.9.0",
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
"framer-motion": "^6.2.10", "framer-motion": "^6.2.10",
"react": "^18.0.0", "react": "^18.0.0",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-router-dom": "^5.3.0",
"react-scripts": "5.0.0", "react-scripts": "5.0.0",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
......
import { Button } from '@chakra-ui/react'; import "./App.css";
import './App.css'; import { Route } from "react-router-dom";
import Homepage from "./Pages/Homepage";
import { Button } from "@chakra-ui/react";
import ChatPage from "./Pages/ChatPage";
function App() { function App() {
return ( return (
<div className="App"> <div className="App">
<Button colorScheme='blue'>Button</Button> <Route path="/" component={Homepage} exact />
<Route path="/chats" component={ChatPage} />
<Button colorScheme='blue'>Button</Button>
</div> </div>
); );
} }
......
import React from "react";
const ChatPage = () => {
return (
<div>Chat Page</div>
);
}
export default ChatPage
\ No newline at end of file
import React from "react";
const Homepage = () => {
return(
<div>
Home Page
</div>
);
}
export default Homepage;
\ No newline at end of file
import React from 'react'; import React from "react";
import ReactDOM from 'react-dom'; import ReactDOM from "react-dom";
import './index.css'; import "./index.css";
import App from './App'; import App from "./App";
import { ChakraProvider } from '@chakra-ui/react' import { ChakraProvider } from "@chakra-ui/react";
import { BrowserRouter } from "react-router-dom";
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
<BrowserRouter>
<ChakraProvider> <ChakraProvider>
<App /> <App />
</ChakraProvider> </ChakraProvider>
</BrowserRouter>
</React.StrictMode>, </React.StrictMode>,
document.getElementById('root') document.getElementById("root")
//rendering everything on root tag //rendering everything on root tag
); );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment