DEV Community

Franco Sirena
Franco Sirena

Posted on

2 1

Thank you react-redux!!

From react-redux 6 and further, people won't be able to access store from outside of the Provider Context. I mean, they can still try and sometimes they think that they succeeded, BUT, the underlying truth is that they will be probably failing every single time.

As from the version mentioned and above, if you access the state from outside of the reducer context while doing an action, you'll see a really scaring error showing up. That should be in there ever since day 1 in Redux, but it wasn't and now it is, which will simply prevent people from doing risky stuff like exposing store in a variable to access it in components/methods without using a connect or a hook ( react-redux > 7 ).

In one of the apps that I work with, our team had the terrible habit of doing that. When I realised it was too late and that pattern was already spread all over the application, thankfully during react-redux migration those errors started to occur and I finally had a extremely powerful reason to convince people that it was wrong, and I finally could get rid of that extremely painful and risky anti pattern.

So, thank you react-redux for doing that! Icing sugar is the store as prop deprecation, but, that shouldn't be even considered a breaking since no one should be using ( but, yes, we were using it too ).

Billboard image

Use Playwright to test. Use Playwright to monitor.

Join Vercel, CrowdStrike, and thousands of other teams that run end-to-end monitors on Checkly's programmable monitoring platform.

Get started now!

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay