Anyone get the react router working? If so have y...
# react
s
Anyone get the react router working? If so have you been able to find/use:
Copy code
withRouter
(https://reacttraining.com/react-router/web/api/withRouter). I haven't been able to find it in the wrappers and haven't been successful in calling it myself on my class components.
b
Just use
hashRouter
or
browserRouter
dsl builders
s
I have been and they work great, what I am looking for is programmatic control.
Copy code
*router*.history.push(*path*
I know you have access to that in a component that is a result of a route, but it seems that there should be a way to trigger a route based on something other than a link click.
b
Hmm, cant you just do plainJS way?
as in
window.location.hash = x
s
huh, smart. I didn't think of that, I suppose you could. I'll have to mess around with that and see if it integrates well. Seems hackish, but also can't see why it wouldn't work. Thanks
b
Yeah, I'd write some kind of HashManager object to control what goes where and use it from components
Rather than having components accessing hash directly
This way it's less hacky 😄
s
Good call 👍