One of my server components fetches and displays data only when the user is authorized:
function CheckAuthorization() {
const isAuthenticated = // check if user is authorized
return (
<div>
{isAuthenticated ? (
<DisplayAuthorizedData/>
): (
<p>Unauthorized</p>
)}
</div>
);
}
In the header of my page, there is a button that initiates the OAuth authorization flow. Upon returning to our page, it sets the isAuthenticated
state to true.
How can I trigger a rerender of the CheckAuthorization
component to display the DisplayAuthorizedData
component?