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

memoize class-names #22

Open
2 tasks
elmarsto opened this issue Jul 3, 2023 · 1 comment
Open
2 tasks

memoize class-names #22

elmarsto opened this issue Jul 3, 2023 · 1 comment
Labels
enhancement New feature or request perf

Comments

@elmarsto
Copy link
Owner

elmarsto commented Jul 3, 2023

I use @sindresorhus/class-names liberally throughout my codebase, because it makes tailwind config strings managable. However it also introduces overhead in every render.

Mitigation:

  • replace direct calls to this library with calls to a wrapper function, say, @/sbstr8/lib/class-names, that provides memoization (via ramda?
  • does useMemo work in server components? A quick google did not find definitive answer -- someone claims that no hooks work, but this is obviously false (usehooks.com etc.). If useMemo() works in server components, this could be a decent implementation path
@elmarsto
Copy link
Owner Author

elmarsto commented Jul 4, 2023

thinking more about this:

  • two separate hooks with the same name could be used, like we do for useOverride().
  • client-side hook backed by useMemo()
  • server-side hook backed by ramda

@elmarsto elmarsto added enhancement New feature or request perf labels Jul 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request perf
Projects
None yet
Development

No branches or pull requests

1 participant