nytimes / kyt-starter-universal

Deprecated, see: https://github.com/NYTimes/kyt/tree/master/packages/kyt-starter-universal
Other
33 stars 6 forks source link

Support for Redux #10

Open giedrius-timinskis opened 8 years ago

giedrius-timinskis commented 8 years ago

Hello,

This is more of a question/request than an issue. Has anyone done Redux implementation with the universal kit? I'm currently trying to implement one and keep running server-side implementation issues.

delambo commented 8 years ago

Would you mind sharing your fork? We could probably help you from there, and hopefully that will inspire a redux starter-kyt.

giedrius-timinskis commented 8 years ago

https://github.com/giedrius-timinskis/kyt-starter-universal/commit/f2f04d88ff023e1b38c954f0172b7a7e00050b8f This is the version that seems to work. The implementation sets up the initial state server-side and then passes that state into the client side.

delambo commented 8 years ago

Nice!

I haven't done a lot of Redux work but I really like the idea of following the Ducks file pattern.

I'd love to hear your - or anyone's - thoughts on that.

mrmckeb commented 8 years ago

We've used Ducks before and it's not hard to wrap your head around. I'd love to see this as an option in the server-side and non-server-side starter kits.

sabha commented 8 years ago

There are two parts to solve , we faced more issues with Server side rendering + Redux

  1. Dynamic reducers
  2. Async Data fetching

Complexity is primarily with component/router life cycle hooks with Flux architecture.

Solved # 1 by Injecting reducer for each route - http://stackoverflow.com/questions/32968016/how-to-dynamically-load-reducers-for-code-splitting-in-a-redux-application

Still Solving # 2 by different approach - static fetch call per component , resolving nested reducer. Finally end up keeping the reducer normalized rather deeply nested. https://www.npmjs.com/package/redux-async-connect

Over all it requires more architecture work to handle , HTTP errors , keeping client & server STATE in sync , exception handling globally , authentication , authorization , showing spinners :-) etc

Thanks a lot for putting all the config together and made Developers life easy.

oscar-g commented 7 years ago

@giedrius-timinskis, I created a quick & dirty redux example, using Ducks, as suggested by @mrmckeb. Let me know if you'd like a pr into your branch

https://github.com/oscar-g/kyt-starter-universal/tree/dev-redux-example

giedrius-timinskis commented 7 years ago

@oscar-g Looks good! Let's get @mrmckeb to review as well.

janhoogeveen commented 7 years ago

See: https://github.com/NYTimes/kyt/issues/213#issuecomment-277010440