我想从对象中的函数获取返回值
它可以在对象中调用函数,但我无法获得返回值
我应该怎么做
const depthCheck = state => {
let index = state.index === undefined ? null : state.index;
if (index !== null) {
depthCheck(state.routes[index]);
} else {
console.log(state);
return state;
}
};
const RootStack = createStackNavigator(
{
TabNavigator,
},
{
defaultNavigationOptions: ({ navigation }) => (
//call function but i cant get return value from console
console.log(depthCheck(navigation.state))
),
},
);