useStore
- ReactuseContext
wrapper. Throw an error if Context is empty.
Example:
const { loadData } = useStore(MyStoreContext);
useOutsideClick
- Click outside of definedref
(used for closing dropdowns, modals). Removes listener whenopen
is false.
Example:
const ref = useRef(ref)
const [open, setOpen] = useState(false);
const closeHandle = () => setOpen(false);
useOutsideClickClose(open, ref, closeHandle);
return (
<div ref={ref}>...</div>
);
createProvider
- Creates provider component and context for mobx stores.
Example:
const { Context, Provider } = createProvider(MyMobxStore);