Closed WorldSEnder closed 3 years ago
use_style! macro as is invokes use_context once per usage
I think there's very little incentive to optimise this.
I do not think a component would have many use_style!
hooks in the same component to the extent that the performance would be degraded.
It is common to access the same context with useContext
multiple times in custom hooks in React.
Accessing context content should be a cheap operation, or else it's a problem of Yew to optimise.
https://github.com/reduxjs/react-redux/blob/master/src/hooks/useSelector.ts#L143
I was also debating
use_stylist
as I think the angle of using it in custom hooks is a valid and useful use case. Theuse_style!
macro as is invokesuse_context
once per usage, while the injectedcss!
macro reuses the same manager, retrieved only once. Quite unsure if there's any strong conclusions to draw from this.