Skip to content

Commit

Permalink
Revert "Revert "check: add intentionally uncompilable code to see whe…
Browse files Browse the repository at this point in the history
…ther action works or not""

This reverts commit df0850a.
  • Loading branch information
kirillzyusko committed Jul 24, 2024
1 parent 884f90e commit dd1ee50
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/hooks/useInitialValue.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import {useState} from 'react';
import {useEffect, useState} from 'react';
import {useSharedValue} from 'react-native-reanimated';

// In some places we set initial value on first render, but we don't want to re-run the function
// This hook will memoize the initial value and return that without setter, so it's never changed
// https://github.com/Expensify/App/pull/29643#issuecomment-1765894078
export default function useInitialValue<T>(initialStateFunc: () => T) {
const a = useSharedValue(0);
const [initialValue] = useState(initialStateFunc);

useEffect(() => {
// eslint-disable-next-line react-compiler/react-compiler
a.value += 1;
}, []);

Check warning on line 14 in src/hooks/useInitialValue.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

React Hook useEffect has a missing dependency: 'a'. Either include it or remove the dependency array

return initialValue;
}

0 comments on commit dd1ee50

Please sign in to comment.