在反应性上加载ajax内容 - reactjs

时间:2017-09-21 22:29:23

标签: javascript ajax reactjs

看起来很简单,但我被困在这里。我只想加载ajax内容并在表中呈现它。我能够使用静态内容

来渲染它
var handler = StripeCheckout.configure({
  key: 'pk_test_aaaaaaaaaaaaaaaaaaaa',
  image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
  locale: 'auto',
  token: function(token) {
    // You can access the token ID with `token.id`.
    // Get the token ID to your server-side code for use.
  }
});

document.querySelector('.stripe-button').addEventListener('click', function(e) {
  // Open Checkout with further options:
  handler.open({
    name: 'Title',
    description: 'description',
    currency: 'eur',
    amount: 9700
  });
  e.preventDefault();
});


// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
  handler.close();
});

我得到了奇怪的错误未捕获的TypeError:this.data.concat不是函数

我正在使用example

1 个答案:

答案 0 :(得分:0)

对不起伙计这是我身边的愚蠢错误,我声明了数组而不是对象

constructor(props) {
        super(props);
        this.state = {appData: []}; //previously it was appdata:{}


 }

感谢@bennygenal指出