fac-12 / FAC-Events-Search

Event Finder Prototype
http://fac-eventfinder.herokuapp.com
3 stars 0 forks source link

React routing #69

Open Jbarget opened 6 years ago

Jbarget commented 6 years ago

Instead of handling location changes yourselves the standard is to use https://github.com/reactjs/react-router-redux

https://github.com/reactjs/react-router-redux#tutorial

it gives you access to a bunch of things on this.props.router when you wrap your component with

import { withRouter } from 'react-router-redux'

export withRouter(LandingPage)
shannonjensen commented 6 years ago

We are definitely still learning about best way to use react router but can you specify where we are handling location changes ourselves? I thought we generally were using React Router...

shannonjensen commented 6 years ago

All navigation is through the Link React Router tag, so still not sure what you meant by this comment?

Jbarget commented 6 years ago

gotcha,

so you're keeping a hold of some location state here: https://github.com/fac-12/FAC-Events-Search/blob/master/client/src/reducers/locationReducer.js

and using it here: https://github.com/fac-12/FAC-Events-Search/blob/b79bdef449a049baab266458205730200913a112/client/src/components/Header/Header.js#L18

react-router-redux handles that for you so you wont have to. (see the links in the comment above) and your location is available via this.props.router.location along with a bunch of other stuff