The accepted answer is good.
Just to make it easier to understand.
Example component:
export default function MyComponent(props) {
const [updateView, setUpdateView] = useState(0);
return (
<>
{updateView}
>
);
}
To force re-rendering call the code below:
setUpdateView((updateView) => ++updateView);