useTriggerableRender

<function> useTriggerableRender()

Returns a callback that re-renders the component when invoked. Avoids React’s forced re-render problem in functional components, which is essentially the only thing that class-based components does better than functional components (at least in React).

Do not call this directly in the renderer. You will enter an unescapable infinite loop. Use this function exclusively as part of a hook that you know will not be invoked every single render, or anywhere else in your code that simply isn’t within the direct execution flow of the renderer.

Example:

local render = useTriggerableRender()
useEvent('MouseButton1Click', function()
	render() -- re-render the component on click
end)