score:2
Accepted answer
I'm new too but I found a simple solution, I hope that works for you, this still works for me.
- Download the SVG file: "svgator":
- Put the SVG file in your React app where you most desire, in my case is in assets folder:
- Import the SVG file in your component, in my case is in App.js file:
- My "App.js" file, is declared as a Class Component, at the return statement after the render method, you can put the "object" tag, taking as a data parameter the SVG component:
return (
<div className={styles.App}>
<object data={Test} />
</div>
)
You don't need to remove anything from anywhere in this case, simple but hope this can work for you.
Source: stackoverflow.com
Related Query
- File exported from SVGator fails to compile in React
- React project failing to compile after changing a file name from .js to .jsx
- React - I have six files that export a variable and want all the variables to be exported from one file
- React App Fails to Compile Due to eslintrc File in a Distant Parent Directory
- loading json data from local file into React JS
- Generating a PDF file from React Components
- How can I render HTML from another file in a React component?
- How import object from external JS file in React JS using web pack
- Material UI v4 makeStyles exported from a single file doesn't retain the styles on refresh
- React Bootstrap error: 'AccordionCollapseProps' is not exported from './AccordionCollapse'
- React & Jest: Cannot find module from test file
- React Typescript: Get files from file input
- Create PDF file from HTML text React
- Jest fails Cannot find module 'react/lib/React' from 'ReactShallowRenderer.js' after React 16 upgrade
- ts-jest fails to run a tsx test file because of "Import" from a module's js file
- How can I get data from a local file into my React app?
- how to import data in react from a js file to use in components
- How to properly import React JSX from separate file in Typescript 1.6
- React Jest test fails to run with ts-jest - Unexpected token on imported file
- Best way to store file objects in React Redux store (files upload from DropZone?)
- "You require appropriate loaders", Using react native and expo. App fails to compile on the web, but runs on android
- Create react app - how to copy pdf.worker.js file from pdfjs-dist/build to your project's output folder?
- React Jest test fails to run with ts-jest - Encountered an unexpected token on imported file
- How to extract data to React state from CSV file using Papa Parse?
- My React app is using values from the .env file instead of the .env.local file
- I'm trying to download a pdf file from a node server to a react client but when I open it, it shows blank
- Webpack 5 Receiving a Polyfill Error?!?! My JavaScript React project is receiving a polyfill error while trying to compile my webpack.config.js file
- Writing to files using File System Access API fails in Electron + Create React App
- Getting error when try to use React Router v6: Attempted import error: 'Action' is not exported from 'history'
- React query mutation: getting the response from the server with onError callback when the API call fails
More Query from same tag
- How can I add live-reload to my nodejs server
- Error [ERR_HTTP_HEADERS_SENT] while trying to login with wrong password
- How to prepare a React.js component for usage in ClojureScript as an external Reagent component?
- Trigger an onChange event after a select element is re-rendered in React
- REACT - Attach event handler to children
- How can I get innerHTML when clicking a button in React js?
- TypeScript compiler error with React Stateless Function component
- adding jquery to react component and update state
- delete happens before opening a modal with confirmation to delete
- Babel configuration with decorators & class properties not working
- TypeError: movie.directors is undefined
- Iterate nested array of objects, find id and update object matching the id
- React callback to parent not changing state
- Nav not collapsing when a NavItem is selected on mobile devices
- React.NET, Webpack - 'ReactDOM' is undefined (client side)
- Error message display when you close the modal
- React passing two arguments function to onContextMenu event
- Style root element using css file, but not working
- Can not get media templates working using styled-components
- Helmet is not a valid jsx element
- How to Render a page / component in UseEffect?
- React-bootstrap Datetimepicker issue
- Fetching large amount of data with loop or recursion with progress percentage in React / React native
- React JS to display month based on user input
- Webpack Code Splitting 'Loading chunk failed' error wrong file path
- .map json from prisma in component
- Importing images dynamically from JSON file in reactJS
- How to change useState's state without re-rendering the component, but just its components
- Modal won't appear in react
- useState variable not holding its state during onChange event