BrowserRouter에는 history를 세팅할 수 없다.
history 모듈로 BrowserHistory를 생성해서 넣으려면 Router 컴포넌트를 사용해야 한다.
import { Router, Route, Switch } from "react-router-dom";
export const history = createBrowserHistory();
function Routes({}: RoutesProps) {
return (
<Router history={history}>
<Switch>
<Route path="/signin" component={SigninPage} />
<Route path="/signup" component={SignupPage} />
<PrivateRoute exact path="/" component={HomePage} />
<PrivateRoute path="/project" component={ProjectPage} />
<Route render={props => <Err404 />} />
</Switch>
</Router>
);
}
'Grew from > Trouble Shooting' 카테고리의 다른 글
TypeError: loaderUtils.getOptions is not a function (0) | 2021.05.20 |
---|---|
[typescript react] 'React' refers to a UMD global, but the current file is a mod (0) | 2021.03.02 |
[webpack] scss 설정 하다 만난 몇가지의 에러 (0) | 2021.02.25 |
[webpack] TypeError: Cannot read property 'tap' of undefined (0) | 2021.02.15 |
[ios] target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting (0) | 2021.01.14 |