Skip to content

Instantly share code, notes, and snippets.

View vagnerwentz's full-sized avatar
🏠
Working from home

Vagner Wentz vagnerwentz

🏠
Working from home
View GitHub Profile
@vagnerwentz
vagnerwentz / gist:d34df2dad1e626f0d1bad20b83e5f32c
Created January 25, 2021 10:42
Forum Rocketseat dúvida sobre melhor maneira de fazer.
# API
{
"success":true,
"data":[{...,...}],
"error": null,
}
# Interface StocksProps
interface StocksProps {
id: number;
api.get<ClientsResponse>('clients').then(response => {
console.log(response.data.clients.length);
if (response.data.clients.length == 0) {
setNumberClients(0)
}
setNumberClients(response.data.clients.length)
});
api.get<ContactsResponse>('contacts').then(response => {
console.log(response.data.contacts.length);