Skip to content

Commit 7039a75

Browse files
committed
Fix useState call
1 parent 5794b04 commit 7039a75

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/preact/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ export function useModel<TModel>(
504504
| InternalModelConstructor<TModel, []>
505505
| (() => Model<TModel>);
506506

507-
const [inst] = useState(() => (factory as InternalFactory)());
507+
const inst = useMemo(() => (factory as InternalFactory)(), []);
508508
useEffect(() => inst[Symbol.dispose], [inst]);
509509
return inst;
510510
}

0 commit comments

Comments
 (0)