CSUI routing #1025
-
I'm trying to build a chrome extension with plasmo, I' using the cs ui for my extension, now my extension will have multiple pages like initially there will be welcome page then clicking on a button will lead to a diffrent page like that. but I don't know how to do this kind of routing efficiently in CSUI currently i'm using the below approch, which will get out of hand if I add more and more pages, and it is very dificult for complex routing as well. Can someone please help me with any suggesition or something?
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can use the Here's an example of how you can set it up: import { MemoryRouter, Route, Routes } from 'react-router-dom'
import { Main } from '@/pages/main'
import { Protocols } from '@/pages/protocols'
export const Router = () => {
return (
<MemoryRouter>
<Routes>
<Route path="/" element={<Main />} />
<Route path="/protocols" element={<Protocols />} />
</Routes>
</MemoryRouter>
)
} I used this repository as an example: https://github.com/Repyah84/wisher |
Beta Was this translation helpful? Give feedback.
You can use the
MemoryRouter
feature fromreact-router-dom
to handle routing efficiently in your CSUI.Here's an example of how you can set it up:
I used this repository as an example: https://github.com/Repyah84/wisher