Add eslint-plugin-react-hooks

This commit is contained in:
Nicolas Gallagher
2020-02-04 12:50:52 -08:00
parent fc443c5abd
commit 2724ca0293
5 changed files with 22 additions and 11 deletions
@@ -8,19 +8,19 @@ export default function StateChanges() {
currentState: AppState.currentState
});
const handleChange = nextState => {
updateState(previousState => ({
...previousState,
[nextState]: previousState[nextState] + 1
}));
};
React.useEffect(() => {
const handleChange = nextState => {
updateState(previousState => ({
...previousState,
[nextState]: previousState[nextState] + 1
}));
};
AppState.addEventListener('change', handleChange);
return () => {
AppState.removeEventListener('change', handleChange);
};
}, [handleChange]);
}, []);
return (
<View>
+1 -1
View File
@@ -70,6 +70,6 @@ export default function usePlatformMethods(
}
};
},
[classList, hostRef, ref, style]
[classList, hostRef, style]
);
}