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
// main.js | |
const api = new Api({ accessToken: '...', options: {} }) | |
sagaMiddleware.run(rootSaga, api) | |
// saga.js | |
function* fetchUser(api, action) { | |
try { | |
const user = yield call(api.fetchUser, action.payload.userId); | |
yield put({ type: "USER_FETCH_SUCCEEDED", user: user }); |
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
sagaMiddleware.run(rootSaga, someArg) | |
function* someSaga(someArg, action) { | |
// ... | |
} | |
function* rootSaga(someArg) { | |
yield takeEvery('SOME_ACTION', someSaga, someArg) | |
} |
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 {Provider, Client, createClient} from 'urql' | |
import NextApp, {AppContext} from 'next/app' | |
const isServer = typeof window === 'undefined' | |
type Props = { | |
client: Client | |
} | |
const withURQL = (App: typeof NextApp) => |
OlderNewer