From php im returning this html
PHP
$str = "Hello World";
echo json_encode("returnval"=>format_string($str));
function format_string($str){
return "<b>".$str."</b>";
}
React JSX
render () => {
//returnval = html string returned from php
return (
<div>
{returnval}
<div>
<span>Some data</span>
</div>
</div>
);
}
The above prints <b>Hello World</b>
as a text .
But i want the html tags to be executed (in this case as bold)
I cannot write the format_string
function in jsx for some reasons is there any way around this ?