首页 > 解决方案 > 在webview react native中使用其组件时无法访问reactjs功能

问题描述

你好,有人可以帮我如何访问我的 ReactJs 组件中的 useEffect 函数吗?我什至无法在其中显示 console.log ?这是我的代码

网页视图组件:

return <WebView
      source={{
        html: renderToString(
          <GraphView
             data={this.state.data}
             options = {this.state.options}
             opts={this.props.opts}
             nodes = {this.state.nodes}
             edges = {this.state.edges}
          />
        ),
      }}
    />

这是我的 ReactJs 组件

import React,{useEffect} from 'react';

const VisNetwork = (props) => {

  useEffect(() => {
    console.log("show me please")
  });


    return (
         <div style={{position:"absolute",backgroundColor:"white"}}/>
       );
  }

标签: reactjsreact-nativewebview

解决方案


推荐阅读