Allows forcing the rendering of the webcomponent without the need to be tied to a state or property

Since the version of atomico@1.14.* there is the useUpdate hook, with the same functionality but in the core of Atomico.


import { useForceRender } from "@atomico/hooks/use-force-render";


const forceRender = useForceRender();


  1. forceRender: Callback to force rendering of the webcomponent.


Sometimes the rendering of the webcomponent does not depend on a state or property of this, to reflect these changes you can use useForceRender to regenerate the DOM, example:

function component() {
  const ref = useRef();
  const forceRender = useForceRender();

  return (
      <my-component ref={ref} onclick={forceRender}></my-component>

Last updated