Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
import { useState } from "react";
const useLoading = (initialState = true) => {
const [state, setState] = useState({ isLoading: initialState, isFailed: false, isSucceed: false });
return {
...state,
setLoading: () => {
setState({
...state,
isLoading: true,
isFailed: false,
isSucceed: false,
});
},
setFinish: () => {
setState({
...state,
isLoading: false,
isFailed: false,
isSucceed: true,
});
},
setError: () => {
setState({
...state,
isLoading: false,
isFailed: true,
isSucceed: false,
});
},
};
};
export default useLoading;