Skip to content
Permalink
Browse files

Add createInstance to typescript example.

  • Loading branch information...
ghengeveld committed Jul 11, 2019
1 parent 7d069bb commit 34e79ee492117d84bb68b5454b5f0193ff587010
Showing with 7 additions and 1 deletion.
  1. +7 −1 examples/with-typescript/src/App.tsx
@@ -1,8 +1,11 @@
import React, { Component } from "react"
import Async from "react-async"
import Async, { createInstance } from "react-async"
import DevTools from "react-async-devtools"
import "./App.css"

const promiseFn = () => Promise.resolve("baz")
const CustomAsync = createInstance({ promiseFn })

class App extends Component {
render() {
return (
@@ -13,6 +16,9 @@ class App extends Component {
<Async promiseFn={() => Promise.resolve("bar")}>
<Async.Resolved>{data => <>{data}</>}</Async.Resolved>
</Async>
<CustomAsync>
<CustomAsync.Resolved>{data => <>{data}</>}</CustomAsync.Resolved>
</CustomAsync>
</header>
</div>
)

0 comments on commit 34e79ee

Please sign in to comment.
You can’t perform that action at this time.