Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
import React from "react";
export const useRequiredContext = <T>(
context: React.Context<T | null>,
errorMessage?: string,
) => {
const contextValue = React.useContext(context);
if (contextValue === null) {
throw new Error(
errorMessage ?? `Missing context provider: ${context.displayName}`,
);
}
return contextValue;
};