🌅Importing assets
How to import images, SVGs and other static DSFR resources
Let's say, in the DSFR documentation, you come across the following HTML code.
Let's see how we would translate this into React.
Using hardcoded links
This is not the recommended approach since it isn't the more efficient nor the more maintainable way. You should rely on your bundler instead.
First make sure you have this script in your package.json
Now you can simply write the following and it will work:
Rely on your bundler
This is the preferred approach.
Most JS bundlers, by default, emits a separate file and exports the URL when comming across an import of a image or video file format.
Last updated