How to use the connected-react-router.createMatchSelector function in connected-react-router

To help you get started, we’ve selected a few connected-react-router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tpai / r2-starter-kit / src / sagas / panels / post.js View on Github external
* handleDidMount () {
    try {
      const matchSelector = createMatchSelector({ path: '/posts/:id' });
      const match = yield select(matchSelector);
      const id = parseInt(match.params.id, 10);

      yield put(setLoading());
      const { success, error } = yield call(getPostAPI, id);
      if (success) {
        yield put(setPost(success.body));
        yield call(sagas.getUser, success.body.userId);
      } else {
        console.log(error);
        yield put(setFailure());
      }
    } catch (err) {
      console.log(err);
    }
  },