A
A
Alexander2021-06-25 13:29:37
React
Alexander, 2021-06-25 13:29:37

How to import svg icon in styled-components?

How to import svg icon in styled-components?
I need to set the background as an icon, what syntax should I use?
I will be grateful for your help

import { MdDone } from 'react-icons/md'
background: url(${MdDone});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
ParaBellum577, 2021-06-25
@ParaBellum577

you can do it via background-image styles: url('../../../style/imgs/icons/arrow-left.png');
You can add it inline in JSX

<div style={{backgroundImage: `url(${MdDone})`}}></div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question