Problems with the addition of style styles in react lines

question: why doesn"t the style work when an object is put into style= {} in
react?

Code:

loadCssFunc = ()=>{
    return {
        color:"red",
        fontSize:12
    }
}

//render()

<div style={this.loadCssFunc}></div>

can"t be written in this way

Mar.03,2021

add: you can use it, but you don't usually use it that way.
unless you need to add a dynamic value to the style after executing a method. For example, when you finish executing this method, change the fontSize:

const loadCssFunc = {
        color:'red',
        fontSize:12
    }

//render()

<div style={loadCssFunc}></div>
Menu