Skip to content

Instantly share code, notes, and snippets.

@bingex
Created March 13, 2021 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bingex/0f3e4d7204315b48ba265b47509457d8 to your computer and use it in GitHub Desktop.
Save bingex/0f3e4d7204315b48ba265b47509457d8 to your computer and use it in GitHub Desktop.
import React from 'react';
import { END } from 'redux-saga';
import { getProjectsWithPosts } from 'components/ProjectList/redux/actions';
import { wrapper } from 'store';
const Projects = () => {
return (
<ProjectList />
);
};
export const getServerSideProps = wrapper.getServerSideProps(
async ({ store, req }) => {
// Dispatch regular redux-saga action
store.dispatch(getProjectsWithPosts());
// Stop the saga
store.dispatch(END);
await store.sagaTask.toPromise();
}
);
export default Projects;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment