> For the complete documentation index, see [llms.txt](https://vytautaspranskunas.gitbook.io/react-state-rxjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vytautaspranskunas.gitbook.io/react-state-rxjs/core-concepts/router-history.md).

# Router / History

`@react-sate/store` uses two kind of router history

* createMemoryHistory
* createBrowserHistory

**createMemoryHistory** - is used when SSR is enabled and when running unit tests wth `ReactStateTestBed`&#x20;

**createBrowserHistory** - is used in browser app

In order to do redirects you need to do `history.push` and pass route you want to navigate to. Usually, in React, history is passed via props. However there are cases where you would like to do navigation from place where props are not accessible - like from service *e.g. you would like to redirect user to login page from auth service or from http service if response is 401.*&#x20;

For this reason `@react-state/store` exposes history object. It can be accessed via `RouterHistory` class.

```typescript
import { RouterHistory } from '@react-state/store';
...
RouterHistory.history.push('/login');
```
