Riccardo Persiani
Riccardo Persiani

Reputation: 732

Render SVG as Image with Semantic UI React

I am using semantic-ui-react and I have some problems rendering a simple image. After importing image:

import { Button, Image, Header, Card } from 'semantic-ui-react';

This is not working

   <Image floated='right' size='mini' src={require('./icons/logo.svg')}/>

enter image description here

And neither this:

import logo from './icons/logo.svg'
 ...
<Image floated='right' size='mini' src={logo}/>

Upvotes: 2

Views: 1462

Answers (1)

brianespinosa
brianespinosa

Reputation: 2408

Ricardo, that error is telling you that in your Webpack config you do not have a loader configured to handle SVG files. This is probably the one you want to use: svg-loader

Upvotes: 1

Related Questions