how to add background image in react css code example

Example 1: how to add background image in react css

import React from 'react';
import car from './images/car.png'
function App() {
  return (
    <div  styles={{ backgroundImage:`url(${car})` }}>      <h1>This is red car</h1>
    </div>
  );
}

export default App;

Example 2: Setting a background Image With React Inline Styles

backgroundImage: `url(${Background})`

Example 3: how to import background image in inline css in react

style={{backgroundImage: `url(${pencil})`}}

Tags:

Misc Example