mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-26 20:06:26 -08:00
ran formatter fixed lint issues, primarily getting rid of "any"s and swapping to .toSorted()
13 lines
417 B
TypeScript
13 lines
417 B
TypeScript
import { createContext, useContext } from 'react';
|
|
import type { MatrixClient } from '$types/matrix-sdk';
|
|
|
|
const MatrixClientContext = createContext<MatrixClient | null>(null);
|
|
|
|
export const MatrixClientProvider = MatrixClientContext.Provider;
|
|
|
|
export function useMatrixClient(): MatrixClient {
|
|
const mx = useContext(MatrixClientContext);
|
|
if (!mx) throw new Error('MatrixClient not initialized!');
|
|
return mx;
|
|
}
|