相关疑难解决方法(0)

"SyntaxError:意外的令牌<在位置0的JSON中"

在处理类似Facebook的内容源的React应用程序组件中,我遇到了一个错误:

Feed.js:94 undefined"parsererror""SyntaxError:位于0的JSON中的意外标记<

我遇到了一个类似的错误,结果是渲染函数中的HTML中的拼写错误,但这似乎不是这里的情况.

更令人困惑的是,我将代码转回到早期的已知工作版本,我仍然遇到错误.

Feed.js:

import React from 'react';

var ThreadForm = React.createClass({
  getInitialState: function () {
    return {author: '', 
            text: '', 
            included: '',
            victim: ''
            }
  },
  handleAuthorChange: function (e) {
    this.setState({author: e.target.value})
  },
  handleTextChange: function (e) {
    this.setState({text: e.target.value})
  },
  handleIncludedChange: function (e) {
    this.setState({included: e.target.value})
  },
  handleVictimChange: function (e) {
    this.setState({victim: e.target.value})
  },
  handleSubmit: function (e) {
    e.preventDefault()
    var author = this.state.author.trim()
    var text = this.state.text.trim()
    var included = this.state.included.trim()
    var victim = this.state.victim.trim()
    if (!text …
Run Code Online (Sandbox Code Playgroud)

javascript jquery json reactjs

166
推荐指数
11
解决办法
63万
查看次数

标签 统计

javascript ×1

jquery ×1

json ×1

reactjs ×1