dangerously-set-html-content-v1
dangerously-set-html-content-v1 copied to clipboard
How to remove old content after get new content?
When I get content from API, it will be dynamic.
let data = callApi(); <InnerHTML html={data} />
My data look like:
<form>
<p>{title}</p>
</form>
<script>
function test(){}
</script>
Now, how to remove old content after get new content? Because, after get new content, It will notify some error like: "Uncaught SyntaxError: Identifier 'form' has already been declared"
Please help me this issue. Thanks
I'll change as long as you properly update the content, this repo contains an example of how to do it, also, not sure if the interpolation will work here: {title}
since all the content rendered will be outside React context