Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpalmer committed Aug 24, 2018
1 parent ba9cdd4 commit e955d63
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ npm i react-async-elements
- [`<Script>`](#script)
- [`<Video>`](#video)
- [`<Audio>`](#audio)
- [`<Preload>`](#preload)
- [`<IFrame>`](#todo)
- [`<Embed>`](#todo)
- [`<Stylesheet>`](#todo)
Expand Down Expand Up @@ -138,6 +139,39 @@ function App() {
export default App;
```

### `<Preload>`

Preload a resource with `<link rel="preload">`.

**More Info:**

- [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content)
- [Google Developer Blog](https://developers.google.com/web/updates/2016/03/link-rel-preload)

**props**

- `href: string`
- `as: string` - resource type

```js
import React from 'react';
import { Preload, Script } from 'react-async-elements';

function App() {
return (
<div>
<h1>Preload</h1>
<React.Placeholder delayMs={300} fallback={'loading...'}>
<Preload href="https://js.stripe.com/v3/" rel="preload" as="script" />
<Script src="https://js.stripe.com/v3/" async />
</React.Placeholder>
</div>
);
}

export default App;
```

## Todo

- [ ] `<IFrame>`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@
"singleQuote": true,
"semi": true
}
}
}

0 comments on commit e955d63

Please sign in to comment.