Today I was working on a project in which I use React, React-Router and Redux for the front-end.
I also use webpack to build the project, and, since I need dynamic routing, I employ
require
and require.ensure
to exploit Webpack's
[https://webpack.github.io/docs/code-splitting.html](code splitting feature).
I borrowed this idea from react-redux-starter-kit, and for some use cases it is awesome.
A dynamic route looks like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Machine, send, assign, actions } from "xstate"; | |
const { choose, log } = actions; | |
const keychainAccessStates = { | |
initial: "checkingBiometricFactor", | |
states: { | |
checkingBiometricFactor: { | |
on: { | |
RETRY: { target: "checkingBiometricFactor", internal: false }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |