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

SVG is not defined #1

Open
mascardoso opened this issue Oct 17, 2017 · 2 comments
Open

SVG is not defined #1

mascardoso opened this issue Oct 17, 2017 · 2 comments

Comments

@mascardoso
Copy link

mascardoso commented Oct 17, 2017

Hi there.
Trying to call a svg sprite but no avail.
I get the following:

Unhandled rejection ReferenceError: SVG is not defined

On my JSX code:

<SVG svgName='/front/assets/img/spritesvg' />

babelrc:

  "plugins": [
    "jsx-svg-inject",

Any ideas?

I'm using SSR btw

@fatfisz
Copy link
Owner

fatfisz commented Oct 17, 2017

Hi, the plugin does not provide any sort of <SVG> component - you have to provide one yourself. It seems that the <SVG> component in your code is missing, so you could just add a simple one like so:

function SVG({ svgContents }) {
  return svgContents;
}

@fatfisz
Copy link
Owner

fatfisz commented Oct 17, 2017

I'll add more info about this, as it might not be intuitive that the user has to provide the component.

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

2 participants