react-finnhub
v1.0.7
Published
React Library for finnhub-ts
Downloads
64
Maintainers
Readme
react-finnhub
Docs and Source
building on finnhub-ts
Usage
Get your API-Key: https://finnhub.io/register
Provider
import { finnhubClient, FinnhubProvider } from 'react-finnhub'
const client = finnhubClient('YOUR-API-KEY')
<FinnhubProvider client={client}>
<App />
</FinnhubProvider>
Hook
import React, { FunctionComponent, useState } from 'react'
import { BasicFinancials, useFinnhub } from 'react-finnhub'
type ITestProps = {}
export const App: FunctionComponent<ITestProps> = (props) => {
const finnhub = useFinnhub()
const [state, setState] = useState<BasicFinancials>()
finnhub.companyBasicFinancials('AAPL', 'all').then((res) => setState(res.data))
return <h1>{JSON.stringify(state)}</h1>
}