Issue 1:
Do you want to request a feature or report a bug?

Not sure if it is a bug or a feature yet. This relates to Hooks.

It could also be that this is all expected behaviour and one of the workarounds mentioned is required.

What is the current behavior?

I have a hook that depends on the useContext hook. Using it as follows works perfectly:

const MyHookedComponent = () => {
const contextValue = useContext(DemoContext);

return (
//Do something with contextValue
)
}

const MyContextProviderComponent = () => {

return (
<DemoContext.Provider value={someContextValue}>
<MyHookedComponent />
</DemoContext.Provider>
)
}

What if I want to use the getContext hook inline in the same component that declares the DemoContext.Provider ?

const MyContextProviderComponent = () => {
const contextValue = useContext(DemoContext); //Of course this fails due to the Context hierarchy.
return (
<DemoContext.Provider value={someContextValue}>
//Do something with contextValue
</DemoContext.Provider>
)
}

I seem to be unable to get this working.

Please note:

I have a very good reason for solving my issue with Context and not passing props.

The implementation I show above looks trivial and dumb but it is the simplest way to illustrate what the use case is. In my implementation the Provider sits in a complex component that does a lot of data management which I really want to happen at this level.

The usual way to use this will be the first working version I noted above, it is only in the case where the user would want to use the hook inline inside the Provider.

I have searched for a couple of hours and tried various configurations without success, so my apologies if this is a duplicate of another issue.

What is the expected behavior?

Any method to consume context inline in the provider using the same re-usable hook without having to revert back to render props.

I know I can solve this with render props but I am trying to convert an implementation using render props to hooks. I also know I can hoist the Context Provider higher up but in my implementation it would quadruple the code complexity to develop and maintain while introducing extra complexity into the user interface.

Also, by extracting the body inside the Provider to a new component I can also solve this but ideally I would not like to have a user do this for this use case.

Issue 2:
From maintainers: if you have this problem, please see the explanation in #6895 (comment).

I am getting a strange error I've never come across. Googling it doesn't help at all.

Error: performUpdateIfNecessary: Unexcpeted batch number (current 36, pending 31)(...)

It has caused me a lot of headaches. I've reverted to 2 days ago and the error persists, even though 2 days ago everything was running smoothly and all tests were passing.

I would appreciate any sort of direction as to how I can begin to resolve this bug. My guesses are that it's an error with Redux, Webpack, Redux-Form, or React itself. I know, not that precise, but I'm quite lost.

Example redux logger information:

Max OS X, El Capitan 10.11.5

React v15.0.1 (error persists on v15.1.0)

I'm sorry if this isn't specific to React. I did look into the error message code and it appears to be coming from the Facebook/React code.

Thanks!