mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-06-12 17:34:27 +02:00
Merge main into proxy branch (formatting and docs)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import type { DependencyList } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import type { DependencyList } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
/**
|
||||
* Like useState, except it will update the value when the default value changes
|
||||
*/
|
||||
export function useStateWithDeps<T>(defaultValue: T | (() => T), deps: DependencyList) {
|
||||
const [value, setValue] = useState(defaultValue);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: none
|
||||
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
||||
useEffect(() => {
|
||||
setValue(defaultValue);
|
||||
}, [...deps]);
|
||||
|
||||
Reference in New Issue
Block a user