What I’ve done
Today I mostly worked on refactoring — but I did start implementing a new state management architecture. Inspired by this post I found on Medium, this is what I came up with:
For each feature, we’ll have a container that is responsible for retrieving data from our store as well as storing data into it. It may also have some local state that will be needed feature-wide. We’ll then create a Context using React’s new Context API (new in 16.3) and use that to pass data down to whatever components we need to.
This way, we get the benefits of Redux to share state that’s needed across the whole app, as well as less of the Redux boilerplate that comes along with shoving everything into Redux. Using the Context API, our dumb components can easily grab whatever props they need without prop drilling.
This setup feels great to me. Tyler, my frontend colleague, felt good about it too. I’ll post an update in the future after it’s implemented to share how it’s working for us.
I also set up Continuous Integration with CodeShip today.
What I’m working on
I’m currently still working on the above, as well as continuing to research how to automatically keep Rails API docs up to date (and how to keep sample data automatically in sync with my
json-server mock API — thoughts appreciated!
Today I Learned
Had a lunch and learn with my chief architect — learned all about Microsoft’s history of trying to force people into upgrade cycles so they could sell more software, and how they tried to kill the open web and create their own private web so they could create a cash-producing ecosystem where they would have gotten paid for Visual Studio to write web code, paid for web hosting to allow the page to live on MSN, and power to control who and what got to be discovered. Yikes. 🙈
Lastly, I learned that you can rename variables as you destructure them from objects today! 😮🙌
Here’s a few links to things I’ve read, watched, or listened to:
- React State Management Patterns
- Using the React 16.3 Context API to eliminate prop drilling
- Rename & Destructure Variables in ES6
- ShopTalk Show: Episode 322 with Adam Wathan – learned a lot about Tailwind!