Skip to content

UNSAFE_INLINE_HANDLER: Event handler from a string

Severity Fault Stage
error customer (the source package) build output

The component sets an inline event handler from a string (setAttribute(“onclick”, …), el.onclick = “…” or an SVG <set attributeName=“onclick”>), a javascript: URL or a data: HTML document in href, src or action, an xlink:href built at run time, or opens a javascript: URL with window.open (the window it opens is same-origin with the page), which the browser runs as code, an eval in disguise (rule inline-handler).

Pass a function: onClick={() => …} in JSX, or addEventListener(“click”, handler).