Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add something like react-router? #207

Closed
udl opened this issue Jul 26, 2016 · 4 comments
Closed

How to add something like react-router? #207

udl opened this issue Jul 26, 2016 · 4 comments

Comments

@udl
Copy link

udl commented Jul 26, 2016

Hi guys,

thanks for the very well done quick-start package!
I'm not a frontend dev, so forgive me if I'm asking for something really basic.
As far as I understand webpack, you have to add dependencies (like react-router) in webpack.config.js.
Can I do this without ejecting?

@mxstbr
Copy link
Contributor

mxstbr commented Jul 26, 2016

Not quite, to add react-router you have to:

  1. Install it via npm install --save react-router
  2. Use react-router in your app!

For example, you could do something like this:

import { Router, Router, browserHistory } from 'react-router';

/* … */

class App extends Component {
  render() {
    return (
      <Router history={browserHistory}>
        <Route path="/" component={Something} />
      </Router>
    );
  }
}

No need to change the webpack config!

@tylercollier
Copy link

@mxstbr I recommend you update your answer to use the browserHistory:

<Router history={browserHistory}>
...

@samayo
Copy link

samayo commented Aug 9, 2017

@mxstbr Why did you duplicate Router twice in import {Router, Router,...

@detrohutt
Copy link
Contributor

@samayo One of them should have been Route

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants