O'Reilly logo

Cross-platform Desktop Application Development: Electron, Node, NW.js, and React by Dmitry Sheiko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating router service

Everything is fine, except we cannot really select a feed from the menu. We have the state property activeFeedUrl, which is already considered by the Menu component, but we have never used the setActiveFeed action so far to set this state. Nonetheless, in the Menu component, we provided all the items with hash links. To serve browser location navigation, we need a router. There are many implementations available as installable modules. Yet, in this simple example, we will create our own:

./app/ts/Services/Router.ts

 import * as Redux from "redux"; import { IRootState, IMenuItem } from "../Interfaces"; import actions from "../Actions/actions"; export default class Router { constructor( private store: Redux.Store<IRootState> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required