Migrate from vseth Theme 2.0.0 to canine-ui
Work in Progress
This is currently a work in progress page, collecting various things to do to migrate an existing application from the vseth frontend 2.0.0 to canine-ui
The purpose of this page is to be deleted after all tools have been migrated. Since this might take a while, it is so far a place to find guideance on how to upgrade to mantine. This is a collection of Stuff I can't find otherwise (as fast).
The main purpose for this page is the lack of resources I found for the changes in react-router. If there are sensible update guides for libraries, feel free to link them here.
to canine-ui
I am assuming you are using yarn as a package manager for node. If you are using npm, you will have to use the commands
yarn remove @vseth/auth @vseth/auth-components @vseth/components @vseth/vseth-theme react-bootstrap yarn add vseth-canine-ui @mantine/core @mantine/hooks @emotion/react
You will be able to replace most mentions of the @vseth/components by using @mantine/core.
React-Router v5 to v6
useHistory / useNavigate
if you want to send some state, it is sent in the second parameter under the state property, same as indicating a redirect (REPLACE) vs navigate (PUSH).
The useNavigate hook returns a navigate function:
declare function useNavigate(): NavigateFunction;
interface NavigateFunction {
(
to: To,
options?: { replace?: boolean; state?: any }
): void;
(delta: number): void;
}
Note that the second argument is an options arg with replace and state properties.
| Action | v5 history = useHistory() | v6 navigate = useNavigate() |
|---|---|---|
| Navigate | history.push(url) | navigate(url) |
| Redirect | history.replace(url) | navigate(url, { replace: true }) |
| Navigate w/state | history.push(url, params) | navigate(url, { state: params }) |
| Redirect w/state | history.replace(url, params) | navigate(url, { replace: true, state: params }) |