Skip to content

Instantly share code, notes, and snippets.

import React, { Component } from 'react';
class componentName extends Component {
constructor(props) {
super(props);
this.handleClicks = [];
this.props.friends.forEach(friend => {
this.handleClick[fiend.id] = this.handleClick.bind(this, friend.id);
})
}
@moimikey
moimikey / after.js
Last active June 5, 2023 04:50
object literals for redux reducers
// O(1)
const todo = (state, action) => {
const actions = {
ADD_TODO: () => {
return {
id: action.id,
text: action.text,
completed: false
}
},
@pongstr
pongstr / shorthand-javascript-techniques.md
Last active June 22, 2022 20:09
Shorthand Coding Techniques. Original post by @samdeering http://www.sitepoint.com/shorthand-javascript-techniques/

Javascript Shorthand Coding Techniques

My (@pongstr) opinion about shorthand coding techniques

Shorthand code is not really a replacement for normal coding but it is very handy and useful in some cases. There are tons of opinions and debates around this but, again it all comes down what is necessary for your codebase and using it responsibly.