Improve the documentation of dataverse (#116)

This commit is contained in:
Fulop 2022-04-06 17:28:08 +02:00 committed by GitHub
parent 978de3b735
commit 949fe935cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 698 additions and 6 deletions

View file

@ -198,6 +198,14 @@ function ref<T>(key: string, initialValue: T): IRef<T> {
}
}
/**
* An effect hook, similar to react's `useEffect()`.
*
* @param key: the key for the effect. Should be uniqe inside of the prism.
* @param cb: the callback function. Optionally returns a cleanup function.
* @param deps?: the dependency array
*
*/
function effect(key: string, cb: () => () => void, deps?: unknown[]): void {
const scope = hookScopeStack.peek()
if (!scope) {