我想呈现一个组件,但值是在一个jQuery函数内检查输入字段中的更改。ReactJS使用jQuery的动画
控制台返回此错误:
Objects are not valid as a React child (found: [object HTMLDocument]). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons. Check the render method of
Result
代码:
import React, { Component } from 'react';
import Result from './Result';
import * as $ from 'jquery';
import ReactFM from '../lib/ReactFM';
import { config } from '../config';
export let reactfm = new ReactFM(config.apiKey);
let name = $(() => {
$('.input-search').keypress(() => {
let inp = $('.input-search').val();
return reactfm.searchArtists(inp);
});
});
class SearchResults extends Component {
render() {
return (
<div className="search-results">
<Result avatar="" name={name} desc="um deus" />
</div>
);
}
}
export default SearchResults;
'returns reactfm.searchArtists(inp)'return? – jmargolisvt
从lastfm api提取的名称 –
请将您的结果组件添加到您的问题。 – jmargolisvt