Split room state hooks out into separate files

This commit is contained in:
Robin Townsend
2022-10-14 10:50:36 -04:00
parent 02b2aef958
commit 5ed2dc6e0e
5 changed files with 54 additions and 14 deletions

View File

@@ -37,15 +37,3 @@ export const useRoomState = <T>(room: Room, f: (state: RoomState) => T): T => {
// eslint-disable-next-line react-hooks/exhaustive-deps
return useMemo(() => f(room.currentState), [room, f, numUpdates]);
};
export const useRoomAvatar = (room: Room) =>
useRoomState(
room,
useCallback(() => room.getMxcAvatarUrl(), [room])
);
export const useJoinRule = (room: Room) =>
useRoomState(
room,
useCallback((state) => state.getJoinRule(), [])
);