simple-boot-react
v0.0.8
Published
react hook, util, http library
Downloads
5
Maintainers
Readme
simple-boot-react
Our primary goals are
- Provides react hooks, state, utils, and more.
Installation
npm install --save simple-boot-react
hooks
usePromiseState()
manage the state of the promise.
Usage
function Component() {
const data = usePromiseState({
factory: () => Promise.resolve('hello')
})
return (<div>
<div>{data.state}</div>
<div>{data.isError}</div>
<div>{data.isLoading}</div>
<div>{data.isSuccess && data.data}</div>
</div>)
}
useDependencyCallBackCleanUp()
useDependencyCallBackCleanUp
Usage
function Component() {
return <div></div>
}
useNotFalsy()
useNotFalsy
Usage
function Component() {
return <div></div>
}
useNotNullish()
useNotNullish
Usage
function Component() {
return <div></div>
}
useObservable()
useObservable
Usage
function Component() {
return <div></div>
}
useObservableUnsubscribe()
useObservableUnsubscribe
Usage
function Component() {
useObservableUnsubscribe(() => {
return subject.pipe(debounceTime(500), distinctUntilChanged()).subscribe(it => {
// ...
})
})
return <div></div>
}
usePromise()
usePromise
Usage
function Component() {
return <div></div>
}
usePromiseCleanUp()
usePromiseCleanUp
Usage
function Component() {
return <div></div>
}
usePromiseLazy()
usePromiseLazy
Usage
function Component() {
return <div></div>
}
usePromiseNotNullish()
usePromiseNotNullish
Usage
function Component() {
return <div></div>
}
useWindow()
useWindow
Usage
function Component() {
return <div></div>
}