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

[1.0] Include REDUX store if there are store files under store folder #794

Closed
danielo515 opened this issue Apr 12, 2017 · 5 comments
Closed

Comments

@danielo515
Copy link

It would be ideal to provide a mechanism to easily include REDUX.
An example workflow would be look for the store directory, if it exists, Gatsby will:

  • Import Redux
  • import react-redux
  • Add required modules in the bundle (not sure how gatsby handles this)
  • Build an store from the files under the store folder
  • Add the store option to the root React instance using react-redux

This is similar to what NUXT does: https://nuxtjs.org/guide/vuex-store

Optional additions would be to use REDUX sagas.

I'm not sure if I have described the flow in a technically correct manner, I not sure about the correct terminology. Hope it is clear enough to get the idea.

@danielo515
Copy link
Author

This was originally proposed at #777

@danielo515
Copy link
Author

Interesting piece of information: https://github.com/gatsbyjs/gatsby/releases/tag/v0.12.34

@0x80
Copy link
Contributor

0x80 commented Apr 12, 2017

Redux is pretty cool, but you don't have to shout it 😉

@KyleAMathews
Copy link
Contributor

KyleAMathews commented Apr 12, 2017

Hey @danielo515! Thanks for kicking off this discussion!

So this is an ideal use case for a Gatsby plugin. It could automatically import Redux files and wrap the root render with the <Provider> component, etc.

Gatsby v1 has similar APIs as to what's been added to 0.x. If you go to this file and search for apiRunner you'll see the various APIs your plugin can use. https://github.com/gatsbyjs/gatsby/blob/1.0/packages/gatsby/lib/intermediate-representation-dir/production-app.js

Here's two official plugins that are using some of these APIs:

@jbolda jbolda added the v1 label Jun 3, 2017
@KyleAMathews
Copy link
Contributor

Would love to see a plugin for this but closing this now as it's not a core concern.

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

4 participants