How To Set Background Image In React ?

React.js

Nicesnippets

26593

18-03-2020


Hello Friends,

Are you looking for example of react add background image to div. you will learn how to add background image in react css. This tutorial will give you simple example of react background image not showing. you can understand a concept of react bootstrap background image. Follow bellow tutorial step of react set background image to div.

/src/App.js file

import React from 'react';

import './App.css';

function App() {

return (

<div>

<div

style={{

backgroundImage: `url("https://www.nicesnippets.com/image/imgpsh_fullsize.png")`,backgroundRepeat: 'no-repeat',width:'250px',height:'250px',color:'white'

}}>

Nice Snippets

</div>

</div>

);

}

export default App;

I hope it can help you...