mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
style: 💄 fix linting error
This commit is contained in:
parent
fad444032c
commit
70697d9626
@ -1,6 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
const useSetState = <T extends object>(initialState: T = {} as T): [T, (patch: Partial<T> | ((prevState: T) => Partial<T>)) => void] => {
|
||||
const useSetState = <T extends object>(
|
||||
initialState: T = {} as T
|
||||
): [T, (patch: Partial<T> | ((prevState: T) => Partial<T>)) => void] => {
|
||||
const [state, set] = useState<T>(initialState);
|
||||
const setState = patch => {
|
||||
set(prevState => Object.assign({}, prevState, patch instanceof Function ? patch(prevState) : patch));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user