diff --git a/docs/recommend-practices.md b/docs/recommend-practices.md index 21f1a94..55e3350 100644 --- a/docs/recommend-practices.md +++ b/docs/recommend-practices.md @@ -2,7 +2,7 @@ ## Naming -Add a suffix `Atom` to `Value` & `Computed`, and use `Effect` for `Effect`. Since we often need to get values from Atoms in many scenarios, adding the suffix after Atom can avoid naming conflicts. +Add the suffix `Atom` to `Value` and `Computed` and use `Effect` for `Effect`. Since we often need to get values from Atoms in many scenarios, adding the suffix after Atom can avoid naming conflicts. ```typescript const countAtom = $value(0); @@ -10,6 +10,12 @@ const doubleAtom = $computed((get) => get(countAtom) * 2); const updateCountEffect = $effect((get, set, val) => { set(countAtom, val); }); +// ... +const count = get(countAtom) // will not conflict with normal value +// in react component +const updateCount = useSet(updateCountEffect) // Effect suffix is useful for this + +return ``` ## Do not use `store` directly