I have an input field which should be readonly based on some state change. So I have written the JSX like below:
render: function() {
var reo = 'readonly';
return (<input id="output" type="Text" value="0" {reo}/>);
}
In the above code variable reo is hardcoded but in the real scenario it will be evaluated based on some condition like:
var reo = (isDisabled ? 'readonly' : '');
When I am running this it is giving unexpected token error. Whereas when I am writing JSX like this:
<input id="output" type="Text" value="0" readonly/>
it is working fine. Please explain me why this error is occurring and how to correct it.