tw-in-js / use-twind-with

Twind integration packages for frameworks & libraries with examples
MIT License
68 stars 17 forks source link

fix: use class primarily and skip className if preact/compat is imported #21

Open riywo opened 3 years ago

riywo commented 3 years ago

preact/compat changes className to a synonym of class. Thus, we only need this setup when preact/compat isn't imported.

This change fixes failure when preact/compat is used and the component is re-rendered. Close #20

Testings

Confirmed this worked with https://codesandbox.io/s/rrjq1?file=/public/index.js locally with workspace of this package.

If you want to see the working fix, I can update the code sandbox.

planted-sam commented 1 year ago

@sastan @danielweck @eldain @Trugamr are y'all still the active maintainers and can this PR be merged? I'm encountering the same issue as @riywo did where twind is trying to set the className and gets a TypeError. Would love if this fix could be merged in.

planted-sam commented 1 year ago

Ah actually I retract this statement, I tried running the modified library and it did not fix my issue. Got the fix when I removed my imports of React components from a diff library unrelated to twind. So this likely does not need to be merged?