rsnext/examples/with-fingerprintjs-pro/providers/WithoutCache.tsx
Ilya Taratukhin a4117c94b0
Adding example with-fingerprintjs-pro for identifying visitors (#37549)
## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)

Deployed on https://with-fingerprintjs-pro.vercel.app/
2022-06-22 11:48:22 +00:00

31 lines
781 B
TypeScript

import { PropsWithChildren } from 'react'
import {
CacheLocation,
FpjsProvider,
LoadOptions,
} from '@fingerprintjs/fingerprintjs-pro-react'
const fpjsPublicApiKey = process.env.NEXT_PUBLIC_FPJS_PUBLIC_API_KEY as string
export const WithoutCache: React.FC<PropsWithChildren> = ({ children }) => {
const loadOptions: LoadOptions = {
apiKey: fpjsPublicApiKey,
}
return (
<FpjsProvider
loadOptions={loadOptions}
cacheLocation={CacheLocation.NoCache}
>
<div className="App">
<header className="header">
<h2>Solution without cache</h2>
<div className="subheader">
New API call made on every component render
</div>
</header>
{children}
</div>
</FpjsProvider>
)
}