Skip to content

Commit

Permalink
Notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenh committed Nov 14, 2022
1 parent 1be91be commit e5f44ad
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/app-tachyons-fela-prop/src/jsx-dev-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ export function jsxDEV(type, props = {}, ...children) {
if (props) {
const { css, className, ...otherProps } = props;
if (css) {
// Use emotion to convert `{ color: "blue" }` --> `a`
// const cn = renderer.renderRule(() => css, {});
// return _jsxDEV(type, { ...otherProps, className: className ? cn + " " + className : cn }, ...children);
// Use fela/emotion to convert `{ color: "blue" }` --> `a`
const cn = renderer.renderRule(() => css, {});
// Wrinkles with skipping the wrapper FelaComponent/EmotionCssPropInternal are:
// 1) Technically we should get renderer from `useContext` instead of a global variable :shrug:
// 2) Ideally in React 18 we'd use useInsertionEffect to batch style insertions but also maybe :shrug:
return _jsxDEV(type, { ...otherProps, className: className ? cn + " " + className : cn }, ...children);

// Or just use `style`
return _jsxDEV(type, { ...otherProps, style: css }, ...children);
// Or just use `style`, ideally after partitioning `css` into selector/not-selector rules.
// return _jsxDEV(type, { ...otherProps, style: css }, ...children);
}
}
return _jsxDEV(type, props, ...children);
Expand Down

0 comments on commit e5f44ad

Please sign in to comment.