0
I have 2 API addresses below, and I need to create a React card that brings the first API photo, and the second API post.
https://jsonplaceholder.typicode.com/photos/ https://jsonplaceholder.typicode.com/posts
componentDidMount() {
fetch('https://jsonplaceholder.typicode.com/users')
.then(response=> response.json())
.then(users => {this.setState({ post: users})});
}
render() {
const { post, searchfield } = this.state;
const filteredPost = post.filter(post =>{
return post.name.toLowerCase().includes(searchfield.toLowerCase());
})
return (
<div className="App">
<h1 style={{ textAlign: 'center'}}>
Busca de Posts
</h1>
<Buscador searchChange={this.onSearchChange} />
<div className='wrapper'>
<UserList post={filteredPost} />
</div>
</div>
);
}
Make two requests and join the results, what’s the problem?
– Costamilam
I don’t know how to put the results together... , would that be right? Let Apidois = ['https://jsonplaceholder.typicode.com/users', 'https://jsonplaceholder.typicode.com/posts'] componentDidMount();}
– Thiago Pereira
You need to analyze the Apis and see what data the two have in common to use in the union
– Costamilam