Skip to content

Instantly share code, notes, and snippets.

View thehappybug's full-sized avatar
🧙‍♂️

Mehdi Raza Jaffery thehappybug

🧙‍♂️
  • APIMATIC
  • Pakistan
View GitHub Profile
<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'
@thehappybug
thehappybug / keybase.md
Created February 12, 2017 22:07
Identity proof for Keybase

Keybase proof

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: