Reactjs - `component` vs `render` in Route
问题 I have two doubts regarding usage of Route from react-router-dom ( v4.3.1 ): When do we use component vs render in Route : <Route exact path='/u/:username/' component={ProfileComponent} /> <Route exact path='/u/:username/' render={() => <ProfileComponent />} /> How to access the variable username in the URL in both ways? 回答1: When you pass a component to the component prop, the component will get the path parameters in the props.match.params object, i.e props.match.params.username in your