React - 파라미터 값 가져오기

React - 파라미터 값 가져오기

React - get parameter value

get 방식으로 파라미터를 넘겨줄 때, 값을 가지고 오는 방법
// https://irobo.co.kr?name=테스트
const search = this.props.location.search;
const params = new URLSearchParams(search);
const name = params.get('name');

console.log('name: ', name); // 테스트

댓글

가장 많이 본 글