728x90
ReactJS - Add URL Parameter
sorce code는 이전 문서에서 재활용한다.
/...../ 는 생략되었다는 표시임
URL parameters are a fundamental aspect of React Router and a fundamental aspect of building web applications.
URL parameter는 React Router의 기본요소이며 web applications을 작성하는 기본 요소이다.
~cra-router/src$App.js
/...../
<div>
<Route exact path="/" component={Home} />
<Route path="/about/:username" component={About} />
</div>
/...../
~cra-router/src/routes$About.js
/...../
const About = ({match}) => {
return(
{match.params.username} 의 소개
);
}
/...../
~cra-router/src/components$Header.js
/...../
<div className="header">
<Link to="/" className="item">홈</Link>
<Link to="/about/boolean" className="item">소개</Link>
</div>
/...../
Previous Page | Next Page |
'my_lesson > _ReactJS' 카테고리의 다른 글
React-router - NavLink (0) | 2018.04.11 |
---|---|
React-router - Add Route in route (double route) (0) | 2018.04.11 |
React-router - Add Router & Link (0) | 2018.04.10 |
ReactJS - Add React to a New Application (0) | 2018.04.03 |
ReactJS - Sequencial of ReactJS environment setting 환경설정 순서 (0) | 2018.04.01 |
댓글