Skip to content

Multiple stylesheets in a component #182

Closed Answered by jpudysz
sftechswdev asked this question in Q&A

You must be logged in to vote

This is an antipattern: each useStyles hook will cause a re-render, which is the reason for the double re-render.

You don't need a globalStyleSheet. You can:

  1. Use variants and create a BaseText component that accepts these variants and renders different styles: https://www.unistyl.es/reference/variants/
  2. Move your globalStyleSheet to the theme and simply spread (...) the globalStyleSheet into your componentStyleSheet.

I would recommend using variants.

Replies: 1 comment 1 reply

You must be logged in to vote
1 reply
@sftechswdev

Answer selected by sftechswdev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants