How to import a local SVG into react

How do I import a local SVG to use in my app?

import icon from './icon.svg'

Produces the error:

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.

Does Adalo development environment have a preferred loader?

2 ways

Copy and paste the svg code into a react component

export const MySVG = () => <svg>code from filed</svg>

Or else you need to tell babel how to load svg using something like this

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.