Fork me on GitHub

Hey. This feels like one of those questions that should have a quick answer: how do we sanitise HTML against XSS when using {:dangerouslySetInnerHTML {:__html ... }}? I see that DOMPurify is the answer in regular React world, but it's not in cljsjs


I assume this is because it either doesn't work for some reason, or is not required?


@shen Or most likely, no one has needed it, so it is not packaged


surely someone has needed to do this at some stage?


Is it a weird thing to try to do? render stored HTML in a reagent component?


is it possible to throttle re-rendering of children? e.g. I have a component which receives a width from the parent component, but when a CSS animation is running it receives it often, which makes the animation very slow because of the re-renders


so I want to throttle the propagation of the width to the children by let’s say 0.2s of something


You could do something like create a buffered-width and set the child width based on that. Then you could for example track the last time buffered-width was updated. When a new parent width comes in, if less than 0.2s has gone by, ignore it, otherwise update it. Since the value of buffered-width isn’t changing, it won’t redraw the child width


You’d probably want to add a setTimeout in there somewhere to make sure you don’t end up losing the last width change or 3.


yeah, that would work


goog.functions/throttle is very helpful here