router icon indicating copy to clipboard operation
router copied to clipboard

useFocusEffect render twice

Open mrrs878 opened this issue 1 year ago • 2 comments

Which package manager are you using? (Yarn is recommended)

yarn

Summary

useFocusEffect render twice when entry page

This doesn't happen if i use useFocusEffect impoted from '@react-navigation/native'

Minimal reproducible example

import { useFocusEffect } from 'expo-router';

export default () => {

    // log 2 times
    console.log('render');

    useFocusEffect(useCallback(() => {
        //
    }, []));

    return (
        <Text>hello</Text>
    );
};

mrrs878 avatar Jun 19 '23 07:06 mrrs878