matype / picostyle

Ultra small CSS in JS library in 0.4 KB
Other
360 stars 34 forks source link

Picostyle is incompatible with Preact 10 #65

Open samueljseay opened 5 years ago

samueljseay commented 5 years ago

Cross posting this from an issue I raised here: https://github.com/preactjs/enzyme-adapter-preact-pure/issues/61

Picostyle expects the render function to be called with the second argument being the children of the component, not the context, this should be an element, string or array. An invalid VNode is created because of this.

full comment describing the issue here: https://github.com/preactjs/enzyme-adapter-preact-pure/issues/61#issuecomment-508912849

pbondoer commented 4 years ago

Any updates?

pbondoer commented 4 years ago

If you were struggling with this, as a temporary workaround / hack for Preact X, you can do the following:

import picostyle from 'picostyle';
import { h } from 'preact';

const _styled = picostyle(h);

export const styled = (nodeName) => {
  return (decls) => {
    return (attributes, _context, children) =>
      _styled(nodeName)(decls)(attributes, children);
  };
};
B-Teague commented 4 years ago

I'm working on this, but running into typescript type definition errors. I'm new to typescript, so it's taking a little while to figure out.

alexamy commented 2 years ago

Thanks a lot, @pbondoer. This issue should be pinned.