tj / frontend-boilerplate

webpack-react-redux-babel-autoprefixer-hmr-postcss-css-modules-rucksack-boilerplate (unmaintained, I don't use it anymore)
2.93k stars 268 forks source link

Redux router #2

Closed tj closed 8 years ago

tj commented 8 years ago

Too many to choose from wtf, try a few and add one

https://github.com/rackt/redux-simple-router

anthonyshort commented 8 years ago

Just make the route state like everything else :P

  1. On url change you trigger a navigate action
  2. Transform the url into a state object
  3. Change the browser url as a side-effect

Welcome to the weird world of front-end haha

tj commented 8 years ago

It is lovely haha. I haven't dug into any of the routers yet but I'm assuming they add some sort of value, or just more weird abstractions haha. I'm way past the days of trying to have elegant front-end, I just want to get shit in there and work on real things

anthonyshort commented 8 years ago

Exactly. It's impossible to make it really nice. Everything sucks.

tj commented 8 years ago

ashaffer commented 8 years ago

My preference on this is to store only the url itself in state, and materialize everything from that as you render. So you have some high-level router component that takes the current url as a prop, parses it, and returns the correct view. This has the additional benefit of nesting and composing simply.

Something like enroute is good for that.

tj commented 8 years ago

Yea that sounds like a good approach to me too, I'll take a peek

aweary commented 8 years ago

That sounds like a problem that react-router has already solved. I think for a boilerplate repo it would be the best choice for routing since its essentially the de-facto standard for routing with react. As far as redux routing integration, redux-simple-router is a good choice in my experience.

VinSpee commented 8 years ago

another vote here for react-router to manage the actual business of routing and redux-simple-router to expose it to your state tree. I think redux-simple-router is a very simple layer to add on top that only does what you'd expect.

gaearon commented 8 years ago

redux-simple-router + react-router ftw

brianc commented 8 years ago

+1 to what @gaearon @VinSpee, and @Aweary said.

tleen commented 8 years ago

Calypso uses page.js, given your familiarity with it did you already reject it for consideration?

gaearon commented 8 years ago

page.js is cool but it doesn't solve nested UIs so you have to do it on your own. Nested routing is requirement for pretty much any modern app. This is why I like react-router.

tj commented 8 years ago

haha yea agreed, page is a little dated, anything that integrates directly with react is :+1: just stuff you'd have to do anyway

gaearon commented 8 years ago

While we're at it check out RR 2.0 beta API. It's way more straightforward and fixes rough edges of 1.x.

BobDigi420 commented 8 years ago

Yes finally