I hereby claim:
- I am thehappybug on github.
- I am jaffery (https://keybase.io/jaffery) on keybase.
- I have a public key whose fingerprint is 6C1C 542A D207 8027 BB55 578B A59D A383 F38D 48FB
To claim this, I am signing this object:
| type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | |
| export function withAppContext< | |
| P extends { appContext?: AppContextInterface }, | |
| R = Omit<P, 'appContext'> | |
| >( | |
| Component: React.ComponentClass<P> | React.StatelessComponent<P> | |
| ): React.SFC<R> { | |
| return function BoundComponent(props: R) { | |
| return ( |
| <AppContextConsumer> | |
| {appContext => ...} | |
| </AppContextConsumer> |
| import * as React from 'react'; | |
| import { AppContextConsumer } from './AppContext'; | |
| export const PostInfo = () => ( | |
| <AppContextConsumer> | |
| {appContext => appContext && ( | |
| <div> | |
| Name: {appContext.name}, | |
| Author: {appContext.author}, | |
| Url: {appContext.url} |
| import * as React from 'react'; | |
| import { AppContextInterface, AppContextProvider } from './AppContext'; | |
| const sampleAppContext: AppContextInterface = { | |
| name: 'Using React Context in a Typescript App', | |
| author: 'thehappybug', | |
| url: 'http://www.example.com' | |
| }; | |
| export const App = () => ( |
| import * as React from 'react'; | |
| export interface AppContextInterface { | |
| name: string, | |
| author: string, | |
| url: string | |
| } | |
| const ctxt = React.createContext<AppContextInterface | null>(null); |
| import * as React from 'react'; | |
| interface AppContextInterface { | |
| name: string, | |
| author: string, | |
| url: string | |
| } | |
| const {Provider, Consumer} = React.createContext<AppContextInterface | null>(null); |
| import * as React from 'react'; | |
| interface AppContextInterface { | |
| name: string, | |
| author: string, | |
| url: string | |
| } | |
| const {Provider, Consumer} = React.createContext<AppContextInterface>(); |
| npm update react react-dom @types/react @types/react-dom |
| curl 'https://demo.api-platform.com/books' \ | |
| -H 'accept: application/json' |
I hereby claim:
To claim this, I am signing this object: