- To prevent syntax repetition you can abstract common properties from the React object using ES6 Destructuring E.g:
//before
import React from 'react';
class Searchbar extends React.Component {
static propTypes = {
//before
import React from 'react';
class Searchbar extends React.Component {
static propTypes = {
public
and private
scope in your codevar Module = (function() {
var _privateMethod1 = function() {
console.log("private 1");
};
var _privateMethod2 = function() {
function Module(variable1, variable2) {
this.variable1 = variable1;
this.variable2 = variable2;
}
Module.prototype = {
constructor: Module, // specifies the constructor for new instances of the Module class
currentScope: function() {console.log(this);},