Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

createStylesContext Documentation is incorrect #1419

Closed
@TheTedAdams

Description

@TheTedAdams

Subject

createStylesContext

Description

PR #1397 updated the useMultiStyleConfig() documentation to use the new createStylesContext() API rather than the old and deprecated global StylesProvider.

There are two problems with the current state of the documentation:

  1. While <Menu /> is using the new createStylesContext(), <MenuItem /> is still using the global useStyles(). This does not work. (Throws error that child is not in a <StylesProvider />
  2. <Menu /> is calling createStylesContext() from inside the react component. This is causing StylesProvider to be a new element on every render, which will cause children to hard remount (In my case all DOM nodes are being fully removed and re-added each time the parent re-renders.

Documentation should have createStylesContext() moved outside of the parent component, with the child component using the use hook returned by createStylesContext() rather than the global useStyles()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions