andoncloud-dashboard-toolkit
v1.2.21
Published
Made with create-react-library
Downloads
26
Readme
dashboard-toolkit
Made with create-react-library
Install
npm install --save dashboard-toolkit
Usage
import React, { useEffect, useState } from 'react'
import { GraphQLClient } from 'graphql-request'
import type { User } from 'dashboard-toolkit'
import { getSdk } from 'dashboard-toolkit'
const App = () => {
const [users, setUsers] = useState<User[]>([])
const client = new GraphQLClient('http://localhost:4000/graphql')
const sdk = getSdk(client)
useEffect(() => {
sdk.users().then((data) => {
setUsers(data.users)
})
}, [sdk])
return (
<div>
{users.map((user: User) => (
<p key={user.id}>{user.name}</p>
))}
</div>
)
}
export default App