Skip to content

Instantly share code, notes, and snippets.

View robmclarty's full-sized avatar

Rob McLarty robmclarty

View GitHub Profile
@robmclarty
robmclarty / alternativeES6ReactComponent.js
Last active August 29, 2015 14:24
An alternative method of defining a React component in ES6, mixing ideas from Crockford's better parts and https://gist.github.com/jquense/47bbd2613e0b03d7e51c
'use strict';
import React from 'react';
import assign from 'object-assign';
export default function Notification(props, context) {
const propTypes = {
messsage: React.PropTypes.string,
autoHide: React.PropTypes.bool,
isOpen: React.PropTypes.bool,
@mpj
mpj / classless.md
Last active November 13, 2023 16:34

The future is here: Classless object-oriented programming in JavaScript.

Douglas Crockford, author of JavaScript: The Good parts, recently gave a talk called The Better Parts, where he demonstrates how he creates objects in JavaScript nowadays. He doesn't call his approach anything, but I will refer to it as Crockford Classless.

Crockford Classless is completely free of class, new, this, prototype and even Crockfords own invention Object.create.

I think it's really, really sleek, and this is what it looks like:

function dog(spec) {