Skip to content

Context works strange in 16.6.3 in renderToStaticMarkup #14287

@konstantin24121

Description

@konstantin24121

Do you want to request a feature or report a bug?

bug or unexpected behavior

What is the current behavior?

In version [email protected] I used Context.Consumer in renderToStaticMarkup and it works fine if a call it, but in [email protected] Context.Consumer lose Context.Provider. To be precise Consumer loses only new values passed to Provider, default values work fine in all cases.

Example below:

with [email protected] - https://codesandbox.io/s/0movl04pyw
with [email protected] - https://codesandbox.io/s/6j39m60j9n

What is the expected behavior?

Context.Consumer don't lose a context passed with Context.Provider.
Maybe the example is wrong and there is another way to render Context.Consumer's components into a string?

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
In [email protected] - works fine
In [email protected] - context losed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions