From 9853f9cc75000c1c21e188d91395c7deafe4f505 Mon Sep 17 00:00:00 2001 From: marihachi Date: Sun, 30 Jul 2023 12:47:25 +0900 Subject: [PATCH] add tutorial --- docs/tutorials/state.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docs/tutorials/state.md diff --git a/docs/tutorials/state.md b/docs/tutorials/state.md new file mode 100644 index 0000000..230222e --- /dev/null +++ b/docs/tutorials/state.md @@ -0,0 +1,14 @@ +--- +sidebar_position: 6 +--- + +# 状態で処理を分岐する + +```ts +T.alt([ + T.where(state => state.flag, + T.str('a'), + ), + T.str('b'), +]).state('flag', () => true); +```