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 { matchPath, RouteProps } from "react-router"; | |
// historyUpdated event is subscribed to history via history.listen or any other way | |
export const createPathMatcher = <Match = unknown>(config: { | |
path: string | string[] | RouteProps; | |
clock?: Event<any> | Store<any> | Effect<any, any>; | |
}) => { | |
return sample({ | |
source: historyUpdated, |
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
<div block> | |
<div> | |
<div block> | |
<div> | |
<div block> | |
<div> | |
<div> | |
<div block> | |
<div> | |
<div block> |
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
test('stuff', async () => { | |
// форкаем домен, создаем новый независимый скоуп | |
const scope = fork(root, { | |
// в конфиге форка будут модификации, которые применятся к скоупу | |
values: new Map() | |
.set($myStore, value), // подменили стартовое значение стора эксклюзивно для этого скоупа | |
handlers: new Map() | |
.set(myFx, mockHandler) // подменили хэндлер эффекта эксклюзивно для этого скоупа | |
}); | |
NewerOlder