I have two useStates, which stores the values taken from the user.
const [classname, setClassname] = useState('');
const [name, setName] = useState('');
Similarly I have a string that has to be passed as body for the Rest API post request.
const string = '{ \ "class": "Device", \ "name": "some name", \ "instanceNumber": 0, \
"properties": [ \ \ ] \ }';
I have to pass the classname in place of device and and name in place of some name in the string. How can I change the string according to the useState values.