question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional usage without context

See original GitHub issue

I have been wondering why dependence on context is not optional.

Context is always referred to as an unstable and experimental feature, although react and redux are stable libraries widely used in production.

It seems to me that passing a configured store explicitly to connect is no harder than passing action creators to it. This would also mean that we don’t need a <Provider /> component, therefore less api surface area.

Would this update be desired? Or am I missing something and there are hidden complications i’m not considering?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
timdorrcommented, Mar 14, 2017

Oh duh, that’s right. We’ve already got this! 😄

0reactions
markeriksoncommented, Mar 15, 2017

@everdimension : yeah, there’s an FAQ entry that addresses that: http://redux.js.org/docs/faq/StoreSetup.html#store-setup-multiple-stores . Basically, accessing the store via context acts as a lightweight dependency injection mechanism, thus making it easier to test components, less hassle passing the store down, component reuse, etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uses for Optional - java - Stack Overflow
The main design goal of Optional is to provide a means for a function returning a value to indicate the absence of a...
Read more >
Java 8 Optional Usage and Best Practices - DZone
According to the Oracle documentation, an Optional is a container object that may or may not contain a non-null value.
Read more >
Optionals : are bad practices still bad practices if everyone ...
Optional is primarily intended for use as a method return type where there is a clear need to represent "no result," and where...
Read more >
Java Optional Is Not So Obvious - Level Up Coding
Optional is primarily intended for use as a method return type where there is a clear need to represent “no result,” and where...
Read more >
Working With Java 8 Optionals - Random Thoughts on Coding
Rather for this post, we are going to cover how to use the Optional type without resorting to directly accessing the value contained...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found