ericclemmons / react-resolver

Async rendering & data-fetching for universal React applications.
https://ericclemmons.github.io/react-resolver
Other
1.65k stars 52 forks source link

Redux Example #61

Open ericclemmons opened 9 years ago

ericclemmons commented 9 years ago

Using v1:

http://gaearon.github.io/redux/

Also, this should be a form example, IMO. Something to warrant the router, but also having a store.

josebalius commented 9 years ago

+1 looking forward to the redux example

aripalo commented 9 years ago

Sorry to turns this to a "+1 thread", but +1 from me as well. Though I'm probably going to start (trying to) implementing react-resolver + redux in next few weeks so if no one else have done the example before that, I might be able to put together something... though I'm pretty new to React ecosystem, so not sure if my examples will be any good :D

ericclemmons commented 9 years ago

It's cool, I'm using:

https://chrome.google.com/webstore/detail/github-%201s/lddfkkebajnpiicnpfamebilmhamkeme

:)

ericclemmons commented 9 years ago

Which...actually didn't work haha.

Thanks for your support! I'll be doing some TDD tonight for this (Tequila Driven Development).

josebalius commented 9 years ago

@ericclemmons best kind of development right there! lol

aripalo commented 9 years ago

Hahaha I might be doing npm install redux --save & keeping up the Ballmer Peak with some Beer Driven Development as well :D

arush commented 9 years ago

well in that case, +1

ericclemmons commented 9 years ago

This should also how how to handle #82

RanzQ commented 9 years ago

I'm using redux with redux-api-middleware. With @connect I can easily bind my store to the components but I haven't found a nice way to provide the initial state for the store. I'm also using (read: trying to use) server-side rendering with multiple routes (react-router) and code splitting so I was thinking if react-resolver could solve the problem to populate the state based on current route component. :)

Just sharing my thoughts. +1

RanzQ commented 9 years ago

A better solution might be to use redux-promise (more discussion: redux #99). Using that I think it would be possible to call the needed async actions on @resolve and return an asyncAction() or Promise.all(asyncActions). That way the component will have its initial data in redux store before rendering. Somewhat similar what @erikras does with fetchData. I will try this later.

jachenry commented 9 years ago

@RanzQ that's a great idea. maybe it'd be possible to chain @connect with @resolve so that the props passed to @resolve have the action creators and state necessary for loading data. Using this strategy would require us to somehow pass the state/creators through to the react component.

anaibol commented 8 years ago

+1

sars commented 8 years ago

+1

AriaFallah commented 8 years ago

So is there any example usage with redux?

sars commented 8 years ago

@AriaFallah I use https://github.com/Rezonans/redux-async-connect ... It works good with redux

AriaFallah commented 8 years ago

@sars Thanks! I'll take a look