yarn add react-router-dom in react code example Example: install react router npm install react-router-dom