Skip to content

Instantly share code, notes, and snippets.

View denisraslov's full-sized avatar

Denis Raslov denisraslov

  • Revolut
  • London, UK
View GitHub Profile
import { Grid, Input, Select } from 'react-spreadsheet-grid';
// Define the array of positions to choose from them through Select
const positions = [{
id: 1,
name: 'System Architect'
},{
id: 2,
name: 'Frontend Developer'
}, {
{
title() {
return 'Name';
},
value(row) {
return (
<span>{row.name}</span>
);
}
}
import { Grid, Input, Select } from 'react-spreadsheet-grid';
class GridContainer extends React.PureComponent {
constructor(props) {
super(props);
// It is initially not loaded
this.state = {
loaded: false
};
import { Grid, Input, Select } from 'react-spreadsheet-grid';
class GridContainer extends React.PureComponent {
render() {
return (
<Grid
rows={this.state.rows}
columns={this.state.columns}
/>
);
import React, { useState } from 'react';
import { Grid, Input, Select } from 'react-spreadsheet-grid';
import set from 'lodash.set';
import users from './users.json';
const positions = [{
id: 1,
name: 'System Architect'
},{
id: 2,
import React from 'react';
import AdminContent from 'react/components/adminContent';
import UserContent from 'react/components/userContent';
class Page extends React.PureComponent {
render() {
// a Backbone way - still using the global APP instance
if (APP.isUserAdmin()) {
import { getStore } from 'react/store';
const Task = Backbone.View.extend({
listenToStore() {
const taskId = this.taskId;
const store = getStore();
// Listen to changes of the Redux store
store.subscribe(() => {
const state = store.getState();
import React from 'react';
import { connect } from 'react-redux';
import AdminContent from 'react/components/adminContent';
import UserContent from 'react/components/userContent';
class Page extends React.PureComponent {
// Use the state from the store
isUserAdmin() {
import AdminContent from 'views/adminContent';
import UserContent from 'views/userContent';
const Page = Backbone.View.extend({
render() {
const contentNode = this.$('.content')[0];
// Use a method of the global app instance
// (the model of the current user is hold there)
if (APP.isAdminUser()) {
import { getStore } from 'react/store';
const Task = Backbone.View.extend({
events: {
'click .saveName': function(e) {
const name = this.nameInput.value;
// Change the name of the task in the model
this.model.set('name', name);