代码看起来像这样,不知道如何读取响应数据.任何的想法?.
var url = 'http://www.bbc.co.uk/sport/football';
fetch(url, {
mode : 'no-cors'
}).then(function(response) {
console.log(response);
});
Run Code Online (Sandbox Code Playgroud)
我有这个简单的组件,将initialPlayersprops传递给App组件.
import React from 'react';
import ReactDOM from 'react-dom';
var PLAYERS = [
{
name: "xyz",
score: 123
}
];
// App component
class App extends React.Component {
constructor() {
super();
}
componentDidMount() {
this.state = {
players: this.props.initialPlayers
}
}
render() {
return(
<div>
<Header players={this.state.players} />
</div>
);
}
}
// Render component
ReactDOM.render(<App initialPlayers={ PLAYERS }/>,
document.getElementById('root'));
Run Code Online (Sandbox Code Playgroud)
在控制台中出现此错误,并且无法将值传递给Header组件{this.state.players}.任何的想法?.
Uncaught TypeError: Cannot read property 'players' of null
at App.render (bundle.js:14379) …Run Code Online (Sandbox Code Playgroud) 我有下面的 webview 组件,我希望在移动浏览器应用程序中打开链接,而不是在我的应用程序中当前的 webview 中打开。
return() {
<WebView source={{ html: `<a href="https://www.google.com">Google</a>`}} />
}
Run Code Online (Sandbox Code Playgroud)