README
@shopify/react-preconnect
Note: This module is now deprecated. You should move to using the <Preconnect /> component from @shopify/react-html instead.
Reduces request latency by preconnecting hosts
Installation
$ yarn add @shopify/react-preconnect
Usage
This library default exports a <Preconnect /> component, which adds <link />s to <head></head> for the given hosts with dns-prefetch and preconnect relations.
import Preconnect from 'react-preconnect';
...
function App(props) {
const preconnectHosts = [
'api.example.com',
'example.com',
'example2.com',
]
<Preconnect hosts={preconnectHosts} />
}
Interface
export interface Props {
hosts: string[];
}