Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the use of Provider? #21

Open
xialvjun opened this issue May 22, 2019 · 0 comments
Open

What's the use of Provider? #21

xialvjun opened this issue May 22, 2019 · 0 comments

Comments

@xialvjun
Copy link

If you use Provider pattern, why no props to support SSR?
If you don't support SSR, why use Provider pattern?

Provider pattern is the way to support SSR, so two different http requests in one nodejs backend program will not share their global state.

app.get('/', (req, res) => {
  // in Provider pattern, store is created in handler 
  // rather than in module top level which is in fact global
  res.end(renderToString(<Provider store={createStore()}><App /></Provider>));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant