-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browser Router 사용하기 (HashRouter 제거하기) #25
Comments
다른 패스를 BrowserRouter로 사용하려면 Admin 의 basename prop이 필요합니다. 간단하게 history로 해결하는게 나을 것 같습니다. 참조 |
react-admin v4부턴 history의 props가 더이상 사용되지 않습니다.
|
안정화된 버전 사용이 낫지 않을까 생각합니다.
history도 버전호환만 되면 사용가능하니 문제 없을 것 같습니다. |
react-admin v4를 사용한 이유는 MUI v5 사용하기 위함입니다. 저도 |
굳이 버전 낮추지 않아도 history 사용은 가능합니다 import { React } from "react";
import { PostList } from "./users/pages/Posts";
import { Route, BrowserRouter } from "react-router-dom";
import MyLayout from "./layout/MyLayout";
import { Admin, Resource, CustomRoutes } from "react-admin";
import AuthProvider from "./users/controllers/AuthProvider";
import { Dashboard } from "./layout/Dashboard";
import SigniInSide from "./users/pages/SignInSide";
import SignUp from "./users/pages/Signup";
import CreateCalendar from "./calendars/pages/CreateCalendar";
import AddEvents from "./calendars/pages/AddEvents";
import EditEvents from "./calendars/pages/EditEvents";
import JoinCalendar from "./calendars/pages/JoinCalendar";
import EditCalendars from "./calendars/pages/EditCalendars";
import jsonServerProvider from "ra-data-json-server";
import UserSetting from "./users/pages/UserSetting";
//import { createBrowserHistory as createHistory } from "history";
const dataProvider = jsonServerProvider("https://jsonplaceholder.typicode.com");
//const history = createHistory();
const App = () => (
<BrowserRouter>
<Admin
//history={history}
layout={MyLayout}
loginPage={SigniInSide}
title={process.env.REACT_APP_TITLE}
dashboard={Dashboard}
authProvider={AuthProvider}
dataProvider={dataProvider}
checkPermissions={true}
>
{(permissions) => [
<CustomRoutes>
<Route exact path="/calendar/:id" element={<SignUp />} />
<Route exact path="/calendar/new" element={<CreateCalendar />} />
<Route exact path="/calendar/event" element={<AddEvents />} />
<Route exact path="/calendar/edit" element={<EditEvents />} />
<Route exact path="/calendar/:id/:date" element={<SignUp />} />
<Route exact path="/settings" element={<UserSetting />} />
<Route exact path="/calendar/join" element={<JoinCalendar />} />
<Route exact path="/calendar/settings" element={<EditCalendars />} />
</CustomRoutes>,
]}
<CustomRoutes noLayout>
<Route exact path="/signup" element={<SignUp />} />
</CustomRoutes>
<Resource name="posts" list={PostList} />
</Admin>
</BrowserRouter>
);
export default App; |
제가 확인이 부족했습니다. |
|
적용방법
<BrowserRouter>
로<Admin>
을 감싸면 된다.참고
https://marmelab.com/react-admin/doc/4.0/Routing.html#using-a-custom-router
The text was updated successfully, but these errors were encountered: