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
Description
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:
- While
<Menu />
is using the newcreateStylesContext()
,<MenuItem />
is still using the globaluseStyles()
. This does not work. (Throws error that child is not in a<StylesProvider />
<Menu />
is callingcreateStylesContext()
from inside the react component. This is causingStylesProvider
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()