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

createStylesContext Documentation is incorrect #1419

Closed
TheTedAdams opened this issue Feb 10, 2023 · 2 comments
Closed

createStylesContext Documentation is incorrect #1419

TheTedAdams opened this issue Feb 10, 2023 · 2 comments

Comments

@TheTedAdams
Copy link

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()

@stale
Copy link

stale bot commented May 21, 2023

Hi!
This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs within 5 days. Thank you for your contributions.

@stale stale bot added the stale label May 21, 2023
@TheTedAdams
Copy link
Author

This was fixed in PR #1541

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant