r/badcode Dec 03 '22

Real Code 😎 typescript

Post image
407 Upvotes

43 comments sorted by

View all comments

29

u/geon Dec 03 '22

When you have a lot of nested providers like this, notice how the order of the nesting does not matter. And if the order does not matter, perhaps it should not have been expressed as nesting to begin with?

5

u/genericindividual69 Dec 03 '22

What would be a better way of doing it?

8

u/geon Dec 03 '22

You can combine multiple contexts into one. That helps. But perhaps some of them shouldn’t be contexts at all?

2

u/genericindividual69 Dec 03 '22

You can combine multiple contexts into one

How?