From 1517a6276d9552a89b3fbd93b004cabc88f0689d Mon Sep 17 00:00:00 2001 From: Kamyar Taher <61198701+KamyarTaher@users.noreply.github.com> Date: Sat, 27 Jul 2024 20:58:58 +0200 Subject: [PATCH] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b5a8827..94ed595 100644 --- a/README.md +++ b/README.md @@ -52,13 +52,15 @@ const { useSelectors, setDeep } = createStore(initialState); // Example of using selectors function ExampleComponent() { - // Automatic type inference and path suggestion for all functions' input and output - // 'user.name' and 'settings.theme' are inferred as strings, then name and theme will be suggested + // Automatic type inference and path suggestion for all functions' input and output. + const { age } = useSelectors('user.age'); + // You can simply select as many state you want const { name, theme } = useSelectors('user.name', 'settings.theme'); + // 'user.name' and 'settings.theme' are inferred as strings, then name and theme will be suggested // Update state at any depth just by specifying the path const onClick1 = () => setDeep('user.name', 'Jane'); - // Also, you can have access to the current state and return a new one + // You can have access to the current state and return a new one const onClick2 = () => setDeep('settings.theme', (prev) => prev === 'light' ? 'dark' : 'light'); return (