Skip to content

Instantly share code, notes, and snippets.

const connectToServerEpic = (
action$,
) => (
action$
.pipe(
ofType(CONNECT_TO_SERVER),
switchMap(({
hostname,
port,
protocol,
const connectToWebSocketServiceEpic = (
action$,
) => (
action$
.pipe(
ofType(APP_STARTED),
map(
connectToServer({
hostname: 'example.com',
port: 3000,
connectToServer({
hostname: 'example.com',
port: 3000,
protocol: 'ws',
protocolVersion: 'v1',
})
startWith(
setLoading(
'login',
),
userState({
state: userStates.PENDING,
username,
}),
)
const fetchUserEpic = (
action$,
) => (
action$
.pipe(
ofType(FETCH_USER),
switchMap(({
password,
username,
}) => (
const fetchUserEpic = (
action$,
state$,
{ dispatch },
) => (
action$
.pipe(
ofType(FETCH_USER),
tap(() => {
dispatch(
const fetchUserEpic = (
action$,
) => (
action$
.pipe(
ofType(FETCH_USER),
switchMap(({
password,
username,
}) => (
function instance($$self, $$props, $$invalidate) {
let count = 0
const stateModifiers = {
DECREMENT: () => {
$$invalidate('count', count -= 1)
},
INCREMENT: () => {
$$invalidate('count', count += 1)
},
const epic$ = (
new BehaviorSubject(
rootEpic
.pipe(
switchMap((
value,
) => (
typeof value === 'object'
&& value.type
? of(value)
const someEpic = ({
action$,
dispatch,
}) => (
// ...
)