Skip to content

Instantly share code, notes, and snippets.

Nessim Btesh nesbtesh

  • Boston
Block or report user

Report or block nesbtesh

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 SomethingView.js
export default class SomethingView extends BaseTemplate {
// You can always overide the other class functions
renderFooter() {
return (
<div>
...coool footer
</div>
);
}
View BaseTemplate.js
export default class BaseTemplate extends React.Component {
setValue = (e) => {
const obj = {};
obj[e.target.name] = e.target.value;
this.setState(obj);
}
someOtherGlobalFunction() {
.....
}
View Galaxy.js
import React from "react";
import * as d3 from "d3";
import Tooltip from "./Tooltip"
import Icon from "./Icon"
import Spinner from "./Spinner2"
import Network from "./galaxy/Network"
var simulation;
export default class Galaxy extends React.Component {
View Network.js
import React from "react";
import * as d3 from "d3";
var simulation;
var svg;
export default class Network extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
return false;
}
@nesbtesh
nesbtesh / BadComponent.js
Created Feb 24, 2017
BAD EXAMPLE DONT USE THIS
View BadComponent.js
import React from "react";
import * as d3 from "d3";
import Tooltip from "./Tooltip"
import Icon from "./Icon"
import Spinner from "./Spinner2"
import Network from "./galaxy/Network"
var simulation;
var svg;
export default class Galaxy extends React.Component {
View AuthContainer.js
import React from "react";
import {connect} from "react-redux";
import {bindActionCreators} from "redux";
import { push, replace } from "react-router-redux";
class AuthContainer extends React.Component {
componentWillReceiveProps(nextProps) {
this.isAuthenticated();
}
View actions.js
import { checkHttpStatus, parseJSON } from '../utils';
import {LOGIN_USER_REQUEST, LOGIN_USER_FAILURE, LOGIN_USER_SUCCESS, LOGOUT_USER, FETCH_PROTECTED_DATA_REQUEST, RECEIVE_PROTECTED_DATA} from '../constants';
import { pushState } from 'redux-router';
import jwtDecode from 'jwt-decode';
export function loginUserSuccess(token) {
localStorage.setItem('token', token);
return {
type: LOGIN_USER_SUCCESS,
payload: {
View AuthReducer.js
import {createReducer} from '../utils';
import {LOGIN_USER_REQUEST, LOGIN_USER_SUCCESS, LOGIN_USER_FAILURE, LOGOUT_USER} from '../constants';
import {pushState} from 'redux-router';
import jwtDecode from 'jwt-decode';
const initialState = {
token: null,
userName: null,
isAuthenticated: false,
isAuthenticating: false,
View ImageExample.js
import React from "react";
export default class Tooltip extends React.Component {
state = {
visible: false,
imageStatus: null
}
handleImageLoaded = () => {
View AutocompleteItemDumb.js
import React from "react";
import {parseUri} from "../../../utils";
const AutocompleteItem = (props) => {
const {props} = this;
const selectedClass = props.selected === true ? "selected" : "";
var path = parseUri(props.url).path;
path = path.length <= 0 ? props.url : "..." + path;
You can’t perform that action at this time.