我想在我的 ajax 请求完成后呈现我的组件。
你可以在下面看到我的代码
var CategoriesSetup = React.createClass({
    render: function(){
        var rows = [];
        $.get('http://foobar.io/api/v1/listings/categories/').done(function (data) {
            $.each(data, function(index, element){
                rows.push(<OptionRow obj={element} />);
            });
           return (<Input type='select'>{rows}</Input>)
        })
    }
});
但是我收到以下错误,因为我在我的 ajax 请求的 done 方法中返回渲染。
Uncaught Error: Invariant Violation: CategoriesSetup.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.
有没有办法在开始渲染之前等待我的 ajax 请求结束?