const silderValue = averageRound * 20;
{silderValue}%CodePudding user response:
you can do it in this way :
<div style={{width:`${silderValue}%`}}></div>
CodePudding user response:
import React from 'react';
function MyComponent() {
// Calculate the width dynamically using JavaScript
const width = 100;
return (
<div style={{ width: width }}>
This element has a dynamic width.
</div>
);
}