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>
}