<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
handleInputChange(name, value, args = {}) { | |
const { key, ...restArgs } = args; | |
let obj = {}; | |
if (typeof key !== 'undefined') { | |
if (Object.keys(restArgs).length === 0 && restArgs.constructor === Object) { | |
obj = { ...this.state[key], ...{ [name]: value } }; | |
} else { | |
obj = { ...this.state[key], ...{ [name]: value, ...restArgs } }; | |
} |
class JsxControls extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
counter: 100 | |
} | |
} | |
render() { | |
return ( |
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
{ | |
"window.zoomLevel": 0, | |
"editor.fontFamily": "Operator Mono Medium, Menlo, Monaco, 'Courier New', monospace", | |
"editor.fontSize": 14, | |
"editor.fontLigatures": true, | |
"editor.tabSize": 4, | |
"editor.mouseWheelZoom": true, | |
"editor.rulers": [120], | |
"editor.smoothScrolling": true, | |
"editor.tabCompletion": true, |
// var config = require('./config.js').get(process.env.NODE_ENV); | |
var config = { | |
production: { | |
session: { | |
key: 'the.express.session.id', | |
secret: 'something.super.secret' | |
}, | |
database: 'mongodb://<user>:<pwd>@apollo.modulusmongo.net:27017/db', | |
twitter: { |
{ | |
"name": "project-name", | |
"description": "Template for static sites", | |
"version": "1.0.0", | |
"homepage": "http://www.project-name.com", | |
"author": { | |
"name": "Adam Buczynski", | |
"url": "http://adambuczynski.com" | |
}, | |
"license": "UNLICENSED", |
if (!toast.isActive(this.toastId)) { | |
const { message } = response.data; | |
this.toastId = toast.success(message); | |
} |
/** | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { | |
return _.transform(object, function(result, value, key) { | |
if (!_.isEqual(value, base[key])) { |
// component | |
shouldComponentUpdate(nextProps, nextState) { | |
console.group('react-logger'); | |
console.log('[prevProps]', this.props); | |
console.log('[nextProps]', nextProps); | |
console.log('[prevState]', this.state); | |
console.log('[nextState]', nextState); | |
console.log('[propsChange]', difference(this.props, nextProps)); | |
console.log('[stateChange]', difference(this.state, nextState)); | |
console.groupEnd('react-logger'); |