Reactjs json.stringify无法序列化react native中的循环结构

Reactjs json.stringify无法序列化react native中的循环结构,reactjs,react-native,Reactjs,React Native,在这段代码中,当您单击按钮时,应拍摄屏幕截图,并通过更新useState显示屏幕截图,但我得到以下错误: json.stringify无法序列化循环结构 我怎样才能解决这个问题 let [ImageURI, setImageURI,]=useState(<Image source={{uri:'http://website.com/wp-content/uploads/image.jpg'}}/>); 这就是回报: return ( <Fragment>

在这段代码中,当您单击按钮时,应拍摄屏幕截图,并通过更新useState显示屏幕截图,但我得到以下错误: json.stringify无法序列化循环结构 我怎样才能解决这个问题

let [ImageURI, setImageURI,]=useState(<Image source={{uri:'http://website.com/wp-content/uploads/image.jpg'}}/>);
这就是回报:


    return (


 <Fragment>

<Button
title='capture screen'
onPress={captureScreenFunction}

>
</Button>

<Image
source={{uri:ImageURI}}
style={{width:300, height:200, resizeMode:'contain', marginTop:15}}
></Image>

</Fragment>


    )


返回(
)

当然它是循环的,因为在定义
图像
本身时使用了
图像


ImageURI
,我假设这里指的是钩子定义中构造的
ImageURI

let [ImageURI, setImageURI,]=useState(<Image source={{uri:'http://website.com/wp-content/uploads/image.jpg'}}/>);
这也与您稍后在代码中将其设置为的数据类型(字符串)一致

let [ImageURI, setImageURI,]=useState(<Image source={{uri:'http://website.com/wp-content/uploads/image.jpg'}}/>);
let [ImageURI, setImageURI,] = useState('http://website.com/wp-content/uploads/image.jpg');