Skip to content

Commit

Permalink
style: πŸ’„ fix linting error
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed May 30, 2019
1 parent fad4440 commit 70697d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/useSetState.ts
Original file line number Diff line number Diff line change
@@ -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));
Expand Down

0 comments on commit 70697d9

Please sign in to comment.