Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 782 Bytes

README.md

File metadata and controls

29 lines (19 loc) · 782 Bytes

Data fetching example

The app that displayed user name through swapi API.

Demo:

Code example:

import * as React from 'react';
import { Page, Frame, StyleSheet, Text, useFetch } from 'react-figma';


export const App = () => {
    const { isLoading, data } = useFetch(`https://swapi.co/api/people/1`);

    return (
        <Frame>
            <Text>{`isLoading: ${(isLoading && 'true') || 'false'}`}</Text>
            <Text>{`Name: ${data && data.name}`}</Text>
        </Frame>
    );
};                                                                                      

How to run