3 ms·
As someone who is using react-router, there are some good reasons for it: it provides a nice way for the current state of the router (eg. the active route and t
by mambodog 12y ago
As someone who is using react-router, there are some good reasons for it: it provides a nice way for the current state of the router (eg. the active route and the state that represents) to fit into React's re-rendering on updates. Existing off-the-shelf routers don't tend to cover this case (re-rendering from state without re-executing the route), so I wrote a layer on top of Backbone.Router to integrate the two, but react-router means one less thing to maintain, and it also has handy transition hooks (modelled on Ember.Router).
As for the use of JSX specifically, it's handy because it allows expressing ordered associative data, for which in javascript the other choices are both kind of messy: either an array of objects (verbose) or an object (not guaranteed to be ordered).
- thedufer 12y ago> object (not guaranteed to be ordered) This is true as per the ECMAScript spec, but realistically you can count on it (unless your keys are stringified numbers). On the server side of things, this is explicitly depended on in a number of places - the most visible that I know of is Mongo's REPL and its node.js drivers (specifying complex sorting/indexing depends on the objects being ordered).