score:0
Accepted answer
you can use next.js to serve static files.
store the svg files under your public directory rather than under src.
then you can generate urls pointing to those static files in your react template, instead of require
ing them:
data && data.map((item) => (
<img src={`/icons/${item['img']}.svg`} />
))
Source: stackoverflow.com
Related Query
- How to fix the error appropriate loader to handle this file type in react hooks
- how to solve this error You may need an appropriate loader to handle this file type
- React with NextJS and Next-CSS: You may need an appropriate loader to handle this file type
- React - Module parse failed: Unexpected Token. You may need an appropriate loader to handle this file type
- ReactJS error You may need an appropriate loader to handle this file type
- ERROR in ./src/index.js 14:4 Module parse failed: Unexpected token (14:4) You may need an appropriate loader to handle this file type
- webpack4: React babel - You may need an appropriate loader to handle this file type
- ERROR in ./node_modules/leaflet/dist/leaflet.css 3:0 > You may need an appropriate loader to handle this file type
- ERROR in ./src/index.js Module parse failed:Unexpected token (13:16) You may need an appropriate loader to handle this file type
- React babel loader - you may need an appropriate loader to handle this file type
- How do I get an appropriate loader to handle this file type in Django?
- Webpack: Need an appropriate loader to handle this file type error
- Webpack 2 : You may need an appropriate loader to handle this file type React
- webpack ERROR :You may need an appropriate loader to handle this file type
- React import html - Module parse failed: You may need an appropriate loader to handle this file type
- You may need an appropriate loader to handle this file type - Angular 4 with React
- React Failed to compile error: Module parse failed: Unexpected token. You may need an appropriate loader to handle this file type
- how can I solve this problem? `You may need an appropriate loader to handle this file type.` scss react
- IMAGE: You may need an appropriate loader to handle this file type
- "You may need an appropriate loader to handle this file type" error
- Unable to run webpack-dev-server on react-native-web. ERROR: You may need an appropriate loader to handle this file type
- Module parse failed: Unexpected token (7:5) You may need an appropriate loader to handle this file type
- CSS - You may need an appropriate loader to handle this file type
- How to fix 'Expected the return value to be a 31-bit integer' error react hooks
- Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type
- Error: You may need an appropriate loader to handle this file type
- Babel Webpack Error: You may need an appropriate loader to handle this file type
- Click to open PDF - You may need an appropriate loader to handle this file type
- How to fix the type error Type '(string | Element) [] is not assignable to type 'string | Element | undefined' using react and typescript?
- How to fix this function to handle different error type of error catching
More Query from same tag
- How to make use of variable name using array of string in React.js
- Removing a matching string item from a multidimensional array
- React router: going direcly to child path is not working
- Deploy Node Express app to Heroku that serves React app
- How to setup Webpack using Create-React-App for sass-resources-loader?
- JS - ternary statement inside Object.keys()
- How do I deploy a React Webpack web app to Azure App Service?
- Serving static files with express for non-root paths
- saving state in Parent component when passed from the child component- for multiple items(React Hooks)
- how do i reuse a react component but with different colours?
- DeckGL: Prevent map movement when dragging elements
- Testing react-intl components with enzyme
- Online Example (CSS of a Cube) inside React
- electron: Can't load http://localhost:8080
- Wrapping text in a <p> tag, when each letter is a separate <span> (for animation purposes) in react.js
- React class component : Why is it not causing a re-render?
- I am not able to install create react app on my m1 macbook pro
- React callback avoid re-render for child
- Can't pass a property (as props) of fetched data object from child component to another page?
- How to get back the object id after POST method using Sequelize and send it to frontend?
- How to code split packages (fontawesome) from Webpack 4 React project
- React with Hooks: When do re-renders happen?
- Android webview not loading for localhost server
- React Native - how to use local SVG file (and color it)
- I can't access the object what I want from Poke API
- querying mongoose letter by letter
- CRA - window object is undefined - jest/react
- React+Node Express, downloaded docx file is corrupted
- My article state is not returning the proper data?
- React-admin: How to Pass more parameters to a dataProvider for type GET_LIST