astroturf icon indicating copy to clipboard operation
astroturf copied to clipboard

Inline experiment

Open jquense opened this issue 4 years ago • 2 comments

Throwing this up for thoughts. by itself it's not really a win, but maybe it's worth adding some additional options that only enable it in the simple cases, e.g. no spreads to deal with?

I mostly wrote it so that when ppl say "MEH THERE IS ACTUALLY A RUNTIME" i can point them to this :P

jquense avatar May 12 '20 14:05 jquense

i mean, it's definitely neat.

if you wanted to do something more robust, you could possibly use something like the existing JSX transform to convert all the props into a single props object, then look at the resulting props.className and props.style.

like, IIFE style?

<Component {...(() => {
const __props = { ...spread, other, foo };
return { __props, style: { __props.style, ... } };
})()}```

taion avatar May 13 '20 05:05 taion

ooo that's a cool idea.

jquense avatar May 13 '20 13:05 jquense