score:1
Accepted answer
oh man, you're so close! it's not a pathing issue but a css issue. when using background image in a css file, it would look like this:
background-image: url(/images/borealis.jpg);
in what you have now it looks like you just missed the url part. so it will work if you change it to this:
const fondoborealis = {backgroundimage: 'url(/images/borealis.jpg)'};
and to use it you would do this (with one set of curly braces. there are two sets in your current code):
style={fondoborealis}
score:0
var co_img = "/images/borealis.jpg";
const sheshema = {
backgroundimage: "url(" + co_img + ")"
}
<div style={sheshema}>
</div>
this should work. try it.
Source: stackoverflow.com
Related Query
- How can I apply styles online in React with Meteor?
- How to apply global styles with CSS modules in a react app?
- How can I apply Next.js to a React project created with create-react-app?
- How to conditionally apply styles in a react component with CSS Modules?
- How can I export a react material-ui component with 2 styles object? (material-ui V1)
- How do I apply my React styles inline with a ternary operator?
- How can I prevent my functional component from re-rendering with React memo or React hooks?
- How can I make React Portal work with React Hook?
- In React Native how can I test my components with Shallow Rendering?
- how can I use fs in react with electron?
- How can CKEditor be used with React.js in a way that allows React to recognize it?
- How can I serve robots.txt on an SPA using React with Firebase hosting?
- React - How to apply CSS styles to iframe content
- How can I change the color of a Link in React with Material-UI?
- How can I use React with Google Places API, to display place markers on a Google map?
- How can I test React component's style with Jest + Enzyme?
- How can I avoid a TypeScript error with React useRef?
- How can we send OAuth2.0 with axios in React js
- How can I search for a component with specific key in React Developer Tools?
- How can I deal with a long className in React JSX?
- In React Native, How Can I Use KeyboardAvoidingView with a Modal in iOS?
- How to apply styles to react-burger-menu button with styled-components?
- How can I replace screen with React Navigation for React Native
- How can I implement SSO Authentication with Active Directory in React App?
- How can I apply fallback style properties to a React JS component?
- How can I get webpack-dev-server to stop downloading incorrect chunks on content change with React lazy/Suspense code splitting?
- how can I test if useState hook has been called with jest and react testing library?
- ReactJS - How can I implement pagination for react with keep state when route change?
- How can I place text inside an SVG circle with React JS?
- How can I use bootstrap in react with rails
More Query from same tag
- AWS Amplify GraphQL query - list all elements and filter the owner's ones in different view
- React store promise array of objects in state
- Display image in reactjs when the image name is stored in local storage
- Reactjs unit testing array filter includes not working
- validating an email input in javascript
- TypeError dispatcher.useState is not a function when using React Hooks
- Low performance in React Native with Redux
- TypeScript : Object is possibly 'null' useRef
- Updating CSS Module @Value with React
- Styled-Components vs SASS (SCSS) or LESS
- debounce react-jsonschema-form validate function
- ReactJS export const and component from one module
- React - cloning the same object
- handle mutilple async call and wait for all to complete before updating state
- React Context and Provider - TypeError: variable is undefined
- add third-party js library to Create React App
- React: TypeError: dispatch is not a function
- Jasmine test for React gives error and doesn't run tests
- React.js set callback function after execution of first function
- Vast ads in react-jw-player or in reactjs?
- How can I update the parent's state in React?
- Hook state one behind prop state
- How to force server side serving of a route
- Redux: Why is avoiding mutations such a fundamental part of using it?
- react-draggable for individual elements
- react router to be used as the child of <Routes> element error
- redux normalized state: byId and allIds pattern
- React Typescript Class Component Default Props Interface
- CastError: Cast to ObjectId failed for value "undefined" at path "_id" for model "User"
- Chosing first two from the array and the add +(plus) for rest of them