auth0-blog / react-flux-jwt-authentication-sample

Sample for implementing Authentication with a React Flux app and JWTs
590 stars 101 forks source link

How does the RouterContainer work? #28

Open sergonius opened 8 years ago

sergonius commented 8 years ago

I am implementing this thing piece by piece into an application and I am getting "Cannot read property 'getCurrentQuery' of null". I went to see the RouterContainer service and it doesn't seem to have a lot in there. What is this sorcery?

ydogandjiev commented 8 years ago

I hit this issue too; it's because router-server has undergone a number of breaking changes since the version used in the tutorial. Check out my implementation here to see how it works now: https://github.com/ydogandjiev/runthistown-client

Steps:

  1. Create a simple browserHistory module to encapsulate the history singleton (I chose to put it under services): https://github.com/ydogandjiev/runthistown-client/blob/master/src/services/browserHistory.js
  2. In your module.js pass the history singleton to your Router: import History from 'services/browserHistory'; render(({routes}), document.getElementById('content'));
  3. When you want to trigger a navigation from anywhere in your code (in this case from an action) just write this: import History from 'services/browserHistory'; History.push('/');
pedramsaleh commented 8 years ago

@ydogandjiev Your link to your implementation above gives a 404.