React native 分析错误:意外标记,应为,
我得到了这个错误:React native 分析错误:意外标记,应为,,react-native,React Native,我得到了这个错误: 分析错误:意外标记,应为, 我在网上搜索,我试了一下,但什么也没解决。我也没有看到任何错误 构造函数(道具){ 超级(道具); 获取('url'{ 方法:“POST”, 标题:新标题({ 接受:'application/json', “内容类型”:“应用程序/json”,//{ console.log(leaders); } }fetch('url'{ 方法:“POST”, 标题:新标题({ 接受:'application/json', “内容类型”:“应用程序/json”,
分析错误:意外标记,应为,
我在网上搜索,我试了一下,但什么也没解决。我也没有看到任何错误
构造函数(道具){
超级(道具);
获取('url'{
方法:“POST”,
标题:新标题({
接受:'application/json',
“内容类型”:“应用程序/json”,//{
console.log(leaders);
}
}fetch('url'{
方法:“POST”,
标题:新标题({
接受:'application/json',
“内容类型”:“应用程序/json”,//{
console.log(leaders);
}); //
constructor(props) {
super(props);
fetch('url', {
method: 'POST',
headers: new Headers({
Accept: 'application/json',
'Content-Type': 'application/json', // <-- Specifying the Content-Type
}),
body: JSON.stringify(collection) // <-- Post parameters
})
.then((response) => response.text())
.then(leaders => {
console.log(leaders);
}
} <---- here it gives error
fetch('url', {
method: 'POST',
headers: new Headers({
Accept: 'application/json',
'Content-Type': 'application/json', // <-- Specifying the Content-Type
}),
body: JSON.stringify(collection), // <-- Post parameters
})
.then(response => response.text())
.then((leaders) => {
console.log(leaders);
}); // << here's your issue ... missing `)`