In create-react-app
relative paths for images don’t seem to work. Instead, you can import an image:
import logo from './logo.png' // relative path to image
class Nav extends Component {
render() {
return (
<img src={logo} alt={"logo"}/>
)
}
}
More Related Contents:
- styled components final styles are injected directly in DOM with tag, with style tag injection does performance gets affected?
- The create-react-app imports restriction outside of src directory
- babel-loader jsx SyntaxError: Unexpected token [duplicate]
- How to load image files with webpack file-loader
- ES6 modules implementation, how to load a json file
- How to import image (.svg, .png ) in a React Component
- firebase.auth is not a function
- When should I use brackets with imports
- How to store Configuration file and read it using React
- where is create-react-app webpack config and files?
- Importing CSS files in Isomorphic React Components
- Webpack output is empty object
- Webpack breaking change
- Is it possible to use dotenv in a react project?
- “You may need an additional loader to handle the result of these loaders.”
- how to set up an inline svg with webpack
- Electron IPC and nodeIntegration
- Webpack 5 – Uncaught ReferenceError: process is not defined
- Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module ‘babel-preset-react’
- React JS Server side issue – window not found
- Why is my webpack bundle.js and vendor.bundle.js so incredibly big?
- how can I use top level “await” in typescript next.js
- How can I fix the “BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default" error?
- How to dynamically import SVG and render it inline
- How to prevent moment.js from loading locales with webpack?
- React – State not updated
- React Native: Getting the position of an element
- ‘Access-Control-Allow-Origin’ issue when API call made from React (Isomorphic app)
- Firebase-Admin, importing it to react application throws Module not found error
- How to prevent Next.js from instantiating a singleton class/object multiple times?