개발

react-router path 가져오기

제이콥 2020. 2. 29. 19:11

browerHistory를 활용하여 현재주소 가져오기

path 뒤에 #,? 정보도 가져옴

import { browserHistory } from 'react-router';

...

componentDidMount() {
  const location = browserHistory.getCurrentLocation();
  console.log(location.hash);
}