import React, { useState } from 'react';
import Taro, { useDidShow } from '@tarojs/taro';
import { View, Navigator, Text } from '@tarojs/components';
import './index.less';
export default function Index() {
const [bindPhone, setBindPhone] = useState('');
useDidShow(() => {
const { bindPhone } = Taro.getStorageSync('person');
setBindPhone(bindPhone);
});
return bindPhone ? (
<View className="login-components">
<Navigator className="login-content font-medium" url="/page/registerPack/index">
<View className="login-text">登录 / 注册 </View>
</Navigator>
</View>
) : null;
}
请问,我想测试 bindPhone 有值的情况下渲染这个组件,没有值的情况不渲染。如何去测试mock呢,写了很久,网上没找到好的例子