Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Best examples of self-contained React/Redux component
10 points by stevewilhelm on Dec 23, 2016 | hide | past | favorite | 4 comments
I am looking for good examples of React/Redux based self-contained components.


If it's self contained then wouldn't / shouldn't it be a react component without redux? Redux is designed to manage state passing to properties in many components organized in your app, but you're asking about a single component.


This is what confuses me. How would I write a React based component that can manage the retrieving the data it needs and can be easily integrated into other React/Redux based applications.

For example, I wish to write a component that displays the weather for a given date and zip code. I also want to create another component that displays the local events for a given date and zip code.

I want a simple SPA app to include these two components along with a shared chooser component that allows users to select the zip code and date.

Finally, I want to share the weather and event components with other developers so they can incorporate them easily in their own React/Redux based applications.


This is a good read [0]. Been using this approach in several larger applications for a while (with great success).

By decoupling the selection of state from the actual state structure (using relative selectors) + defining a public interface for your features (your app will basically consist of smaller apps - fractally) you can achieve what you're after.

[0] http://jaysoo.ca/2016/02/28/organizing-redux-application/


I keep a list of Redux-related addons and utilities at https://github.com/markerikson/redux-ecosystem-links . Within that list, the "Widgets" page lists a bunch of pre-written React components that use Redux to store their data. Probably the best examples of what you're looking for.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: