Skip to content

Commit

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

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

// 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;
}, []);

return initialValue;
}

0 comments on commit b52158a

Please sign in to comment.