Skip to content

Getting started

Installation

bash
npm install mobx-location-history
bash
yarn add mobx-location-history
bash
pnpm add mobx-location-history

Usage

ts
import {
  createBrowserHistory,
  createHashHistory,
  createMemoryHistory,
  createQueryParams,
} from "mobx-location-history";
import { reaction } from "mobx";

const history = createBrowserHistory();

reaction(
  () => history.location,
  location => {
    console.log(location)
  }
);

const queryParams = createQueryParams({
  history
});

reaction(
  () => queryParams.data,
  queryParams => {
    console.log(queryParams)
  }
);

Released under the MIT License.