React error: Style prop value must be an object react/style-prop-object
You can still use style in react. Try :
style={{float: 'left'}}
The issue is you are passing style as a String
instead of an Object
. React expects you to pass style in an object notation:
style={{ float:`left` }} // Object literal notation
or another way would be:
const divStyle = {
margin: '40px',
border: '5px solid pink'
};
<div style={divStyle}> // Passing style as an object
See the documentation for more info