From 3912e9b30839f7252d0c771d32c35a190cc0d224 Mon Sep 17 00:00:00 2001 From: goodmice Date: Wed, 18 May 2022 12:25:22 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=85=D1=83=D0=BA=D0=B8=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BD=D1=82?= =?UTF-8?q?=D0=B5=D0=BA=D1=81=D1=82=D0=B0=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6?= =?UTF-8?q?=D0=B8=D0=BD=D1=8B=20=D0=B8=20=D1=82=D0=B5=D0=BA=D1=83=D1=89?= =?UTF-8?q?=D0=B5=D0=B3=D0=BE=20=D0=BA=D0=BE=D1=80=D0=BD=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/context.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/context.ts b/src/context.ts index 06311dc..a74e4b9 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,4 +1,21 @@ -import { createContext } from 'react' +import { createContext, useContext } from 'react' + +/** Контекст текущего ID скважины */ export const IdWellContext = createContext(null) +/** Контекст текущего корневого пути */ export const RootPathContext = createContext('') + +/** + * Получает текущий ID скважины + * + * @returns Текущий ID скважины, либо `null` + */ +export const useIdWell = () => useContext(IdWellContext) + +/** + * Получает текущий корневой путь + * + * @returns Текущий корневой путь + */ +export const useRootPath = () => useContext(RootPathContext)