Skip to content

Instantly share code, notes, and snippets.

View SketchSystems.spec
Aaa
Init -> Assignment has challenge?
Assignment has challenge?
yes -> Challenge
no -> Single Package
Challenge
start package -> Work
Work
@asfktz
asfktz / Tabs.jsx
Last active Nov 23, 2019
Context Based Tabs
View Tabs.jsx
import React, { Children, cloneElement, useState, createContext, useContext } from 'react';
const ctx = createContext();
export function Tabs ({ children }) {
const [selectedIndex, selectIndex] = useState(0);
return (
<ctx.Provider value={{ selectedIndex, selectIndex }}>
{children}
View loader.jsx
import './style.css';
import React, { useState } from 'react';
import Spinner from 'react-md-spinner';
import useInterval from '../../utils/useInterval';
import { random } from 'lodash';
const labels = [
'מכוונים את הגיטרות',
'פורשים מחצלות',
View option-1.js
const MyWrapperMiddleware = store => next => action => {
const state = store.getState()
if (!state.isLoggedIn)
return next(action)
const pouchMiddleware = PouchMiddleware({
path: state.currentPath,
db,
View option-2.js
let pouchMiddleware
let invalidate = true;
const MyWrapperMiddleware = store => next => action => {
const state = store.getState()
if (!state.isLoggedIn)
return next(action)
if (someConditionForChange) {
@asfktz
asfktz / UserForm.jsx
Last active Feb 10, 2017
react-redux-form nested reducer issue
View UserForm.jsx
import React from 'react';
import { Control, Form } from 'react-redux-form';
class UserForm extends React.Component {
render() {
return (
<Form model="forms.user"
onSubmit={(user) =>
console.log('-->', user)
}>
View 5.js
class Button extends React.Component {
handleClick = (e) => {
console.log(this)
}
render () {
return (
<div onClick={this.handleClick}>
Click
</div>
View 4.js
class Button extends React.Component {
constructor (props) {
super(props)
this.handleClick = this.handleClick.bind(this)
}
handleClick () {
console.log(this)
}
View 3.js
class Button extends React.Component {
handleClick () {
console.log(this)
}
render () {
return (
<div onClick={::this.handleClick}>
Click
</div>
View 2.js
class Button extends React.Component {
handleClick () {
console.log(this)
}
render () {
return (
<div onClick={(e) => this.handleClick(e)}>
Click
</div>