(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| let UserContext = React.createContext(); | |
| class App extends React.Component { | |
| state = { | |
| user: null, | |
| setUser: user => { | |
| this.setState({ user }); | |
| } | |
| }; |
| 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 ( |
| Promise.all([ | |
| someThingThatReturnsAPromise(), | |
| otherThingThatReturnsAPromise(), | |
| lastThingThatReturnsAPromise() | |
| ]) | |
| .then( results => | |
| { | |
| // this... | |
| const [first, second, third] = results; | |
| // ... instead of |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the \ commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)