Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX style element wrongly interpreted (v1.0.0-beta.15) #655

Open
mikestopcontinues opened this issue Nov 14, 2020 · 0 comments
Open

JSX style element wrongly interpreted (v1.0.0-beta.15) #655

mikestopcontinues opened this issue Nov 14, 2020 · 0 comments

Comments

@mikestopcontinues
Copy link

mikestopcontinues commented Nov 14, 2020

I'm trying to write an inline style element component, but Astroturf is getting in the way. This fails:

function InlineStyle({value, ...props}) {
  return (
    <style {...props} dangerouslySetInnerHTML={{__html: value}} />
  );
}

With this error:

AstroturfLoaderError: /<PATH>/InlineStyle.js: Cannot read property 'name' of undefined
    at Array.some (<anonymous>)
    at Array.filter (<anonymous>)

But this works:

function InlineStyle({value, ...props}) {
  const El = 'style'; // secret sauce

  return (
    <El {...props} dangerouslySetInnerHTML={{__html: value}} />
  );
}

I'm running the most recent beta using the webpack loader via NextJS 10. I think Astroturf should be able to infer the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant