Generalized frontend model store (#193)

This commit is contained in:
Gregory Schier
2025-03-31 11:56:17 -07:00
committed by GitHub
parent ce885c3551
commit f1757ae427
201 changed files with 2185 additions and 2865 deletions

View File

@@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';
/**
* Like useState, except it will update the value when the default value changes
*/
export function useStateWithDeps<T>(defaultValue: T, deps: DependencyList) {
export function useStateWithDeps<T>(defaultValue: T | (() => T), deps: DependencyList) {
const [value, setValue] = useState(defaultValue);
useEffect(() => {
setValue(defaultValue);