mirror of
https://github.com/lux-tel/session-desktop.git
synced 2026-10-30 20:33:24 +00:00
14 lines
453 B
TypeScript
14 lines
453 B
TypeScript
import { createContext, useContext } from 'react';
|
|
|
|
/**
|
|
* This React context is used to share deep into a node tree the message ID we are currently rendering.
|
|
* This is to avoid passing the prop to all the subtree component
|
|
*/
|
|
const ContextMessageId = createContext<string | undefined>(undefined);
|
|
|
|
export const ContextMessageProvider = ContextMessageId.Provider;
|
|
|
|
export function useMessageIdFromContext() {
|
|
return useContext(ContextMessageId);
|
|
}
|