使用浏览器历史记录admin-on-rest

时间:2017-02-28 06:43:59

标签: reactjs admin-on-rest

我们可以在admin-on-rest(React JS)中使用浏览器历史记录而不是hashhistory吗? 我是否需要在admin-on-rest中更改某些内容,或者只是将服务器设置为处理URL?

2 个答案:

答案 0 :(得分:2)

显然现在只需要从history包创建一个浏览器历史记录实例并将其传递给<Admin />组件:

import createHistory from 'history/createBrowserHistory';

const history = createHistory();

const App = () => (
    <Admin history={history}>
        ...
    </Admin>
);

根据documentation

答案 1 :(得分:1)

是的,您可以,但您需要编写自定义应用,而不是使用<Admin>组件。它已在the official documentation中记录。