0
.jsonファイルを読み込み、その内容を読み込もうとしています。しかし、私が得るすべては、このような出力は次のようになります。 AlertWindowネイティブインポートjsonファイルに反応して内容を確認します
これは私のコードです:それは文字列として実際のコンテンツを取得したいと思い
import movies from './movies.json';
/*
...
*/
function componentWillMount() {
return (
fetch(movies).then((res) => res.json()).then((data) =>
{this.setState({hugeText: data.something});
})
);
}
function searchForName(){
var content = componentWillMount();
alert(content);
}
。私はあなたがそのようcomponentWillMountを使用することができるとは思わない
警告に表示されている内容を完全なコード – Codesingh
を共有してください! – Codesingh