Currently, I am facing a situation where I require the div
to have a dynamic width in my React JS code. To achieve this, I tried using
divStyle = {width: calc(100% - 276px)}
, but unfortunately, it resulted in an error stating that calc is not a function
.
While I am aware that this can be accomplished using jQuery, I am hesitant to incorporate jQuery into my application. I am seeking any possible workarounds or clever hacks that could potentially resolve this issue.
Here is a snippet of the code:
customFormat = 'hello-div'
divStyle = {width: calc(100% - 276px)}
return (
<div className={customFormat} style={divStyle}>
Hello World
</div>
)