UNPKG

react-change-highlight

Version:

React component to highlight the changed content immediately and bring focus of the user into the changed part

15 lines (13 loc) 484 B
/* eslint-disable no-console */ const addStyleString = (str: string, isSSR = false) => { if (!document || isSSR) { console.warn( `"react-change-highlight", As you're using server-side rendering, it's a must to create and pass your css class to the highlightStyle attribute for "ChangeHighlight" component.` ); return; } const node = document.createElement("style"); node.innerHTML = str; document.body.appendChild(node); }; export default addStyleString;