Skip to content

Instantly share code, notes, and snippets.

Constantine Antonakos ConAntonakos

Block or report user

Report or block ConAntonakos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View usePromise.js
import { useState, useEffect, useCallback } from 'react'
function usePromise(createPromise) {
const [error, setError] = useState()
const [value, setValue] = useState()
useEffect(() => {
let current = true
View auth-with-reach-router.jsx
let UserContext = React.createContext();
class App extends React.Component {
state = {
user: null,
setUser: user => {
this.setState({ user });
View *


Installation (sorry)

npm i THIS_URL


gaearon /
Last active Oct 5, 2019
A Gentle Introduction to Prepack, Part 1


When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.



  • ✏️ method changes this.
  • 🔒 method does not change this.


  • concat(...items: Array<T[] | T>): T[] 🔒 ES3
etienne-dldc / combineContext.js
Created Mar 28, 2018
A small function to combine react Contexts.
View combineContext.js
import React from 'react';
function onlyChild(children) {
return Array.isArray(children) ? children[0] : children;
export function combineContext(contexts) {
class Provider extends React.Component {
render() {
const init = this.props.children;
View 0

A series of posts on css-in-js

0. styles as objects

First, an exercise. Can we represent all of css with plain data? Let's try.

let redText = { color: 'red' };

3 Gripes With React

I started using React 3.5 years ago, and I still love it. It was such a well-designed solution that not much has changed since then, only superficial stuff like naming. What I learned then is still wholly applicable today because it's such a good idea (although now you can choose from many other libraries). On top of that, we now benefit from an entirely new architecture (fiber) without changing much.

nitin42 / require.js
Created Oct 8, 2017
How Node.js's require() works ??
View require.js
const some_module = require('some_module')
* require('some_module') calls Module._load
* Module._load then tries to load the module with a filename (also save it to the cache) using module.load(filename)
* module.load(filename), given a filename, passes it to the proper extension handler ('.js', '.json')
* If there were any errors when loading the file, it deletes the file from the cache (delete Module._cache[filename]) and throws an error
You can’t perform that action at this time.