aboutsummaryrefslogtreecommitdiff
path: root/src/utils/misc.tsx
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-12-20 00:33:52 +0100
committerVendicated <vendicated@riseup.net>2022-12-20 00:34:26 +0100
commit94ad8e8f61abb3c6256f9caa39878150b326790f (patch)
tree8cda13f72b1778ab667bf8761fee981a7673dcbd /src/utils/misc.tsx
parent989bd36eeb6dd6c4b391900765847cdcf87484d9 (diff)
downloadVencord-94ad8e8f61abb3c6256f9caa39878150b326790f.tar.gz
Vencord-94ad8e8f61abb3c6256f9caa39878150b326790f.tar.bz2
Vencord-94ad8e8f61abb3c6256f9caa39878150b326790f.zip
Add useEffect/useState/useMemo to webpack commons
Diffstat (limited to 'src/utils/misc.tsx')
-rw-r--r--src/utils/misc.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils/misc.tsx b/src/utils/misc.tsx
index 8b7cea2..6710523 100644
--- a/src/utils/misc.tsx
+++ b/src/utils/misc.tsx
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { Clipboard, React, Toasts } from "@webpack/common";
+import { Clipboard, React, Toasts, useEffect, useState } from "@webpack/common";
/**
* Makes a lazy function. On first call, the value is computed.
@@ -48,13 +48,13 @@ export function useAwaiter<T>(factory: () => Promise<T>, providedOpts?: AwaiterO
deps: [],
onError: null,
}, providedOpts);
- const [state, setState] = React.useState({
+ const [state, setState] = useState({
value: opts.fallbackValue,
error: null,
pending: true
});
- React.useEffect(() => {
+ useEffect(() => {
let isAlive = true;
if (!state.pending) setState({ ...state, pending: true });
@@ -72,7 +72,7 @@ export function useAwaiter<T>(factory: () => Promise<T>, providedOpts?: AwaiterO
* Returns a function that can be used to force rerender react components
*/
export function useForceUpdater() {
- const [, set] = React.useState(0);
+ const [, set] = useState(0);
return () => set(s => s + 1);
}