I hereby claim:
- I am bingex on github.
- I am bingx (https://keybase.io/bingx) on keybase.
- I have a public key ASCkejjmng2ihTSgniZFzdNdy08gWaNcjv7d7PV1Lr5mlQo
To claim this, I am signing this object:
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import { createStore, applyMiddleware } from 'redux'; | |
import createSagaMiddleware from 'redux-saga'; | |
import { createWrapper } from 'next-redux-wrapper'; | |
import rootReducer from './rootReducer'; | |
import rootSaga from './rootSaga'; | |
export const makeStore = () => { | |
// 1: Create the middleware | |
const sagaMiddleware = createSagaMiddleware(); |
import { wrapper } from 'store'; | |
const MyApp = ({ Component, pageProps }) => { | |
return <Component {...pageProps} />; | |
}; | |
export default wrapper.withRedux(MyApp); |
import React from 'react'; | |
import { END } from 'redux-saga'; | |
import { getProjectsWithPosts } from 'components/ProjectList/redux/actions'; | |
import { wrapper } from 'store'; | |
const Projects = () => { | |
return ( | |
<ProjectList /> | |
); | |
}; |
import { HYDRATE } from 'next-redux-wrapper'; | |
const initialState = { | |
// initial state here ... | |
}; | |
const projectsReducer = (state = initialState, action) => { | |
switch (action.type) { | |
// This will overwrite client state | |
case HYDRATE: { |
import React from 'react'; | |
import { useSelector } from 'react-redux'; | |
import ProjectSection from './ProjectSection'; | |
const ProjectList = () => { | |
const projects = useSelector(state => state.projectsReducer.projects); | |
return ( | |
<div> | |
{projects.map(project => { |
import {takeEvery, fork, take} from 'redux-saga/effects'; | |
export default function* watcherSaga() { | |
while (true) { | |
const forkedTask = yield fork(uploadMediaWorker, yield take(types.UPLOAD_MEDIA)); | |
yield takeEvery(types.STOP_UPLOAD_MEDIA, stopUploadMediaWorker, forkedTask); | |
} | |
} |
import {cancel} from 'redux-saga/effects'; | |
function* stopUploadMediaWorker(action) { | |
yield cancel(action); | |
} |