-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I have Scenario with Translation Provider
So on one file
const TransContext = createContext<[TFunction, TransProviderActions]>();
export const useTransContext = () => useContext(TransContext);
function createTransContext(){
// some code
}
export const TransProvider: ParentComponent<{ instance?: i18n, options?: InitOptions }> = (props) => {
return <TransContext.Provider
value={createTransContext(props.instance || i18next, props.options )}
children={props.children}
/>
};On import useTransContext other nested component it returns null;
export function Trans(prop: TransProps) {
const [t] = useTransContext(); // this returns null
return <>{t(prop.key, prop.options) }</>
}Metadata
Metadata
Assignees
Labels
No labels