| | *
| *
|
|
| [ { | |
const [values, setValues] = useState<T>(initialData); | |
const setValue = useCallback((key: string | null, value: string) => { | |
if (!key) return; | |
setValues((state) => ({ ...state, [key]: value })); | |
}, []); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gql, useMutation, useQuery } from "@apollo/client"; | |
import useSWR from "swr"; | |
import Layout from "../../components/Layout"; | |
import React, { useState } from "react"; | |
import { | |
useTable, | |
usePagination, | |
useFilters, | |
useGlobalFilter, | |
useAsyncDebounce, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// <script src="https://cdnjs.cloudflare.com/ajax/libs/expect/1.20.2/expect.min.js"></script> | |
// redux api | |
const combineReducers = reducers => | |
(state = {}, action) => | |
Object.keys (reducers). | |
reduce ((accumulator, key) => Object.assign ({}, accumulator, {[key]: reducers [key] (state [key], action)}), {}) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Video Tutorial: | |
https://egghead.io/series/getting-started-with-redux | |
Lesson 05: | |
Redux: Writing a Counter Reducer with Tests | |
http://jsbin.com/piqapi/edit?js,console | |
Lesson 06: | |
Redux: Store Methods: getState(), dispatch(), and subscribe() | |
http://jsbin.com/jadunek/edit?js,console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Create reducer file": { | |
"prefix": "reducer", | |
"body": [ | |
"/**", | |
" * $1 component's reducer", | |
" * @name $1Reducer", | |
" * @memberof app.reducers", | |
" * @typedef $1Reducer", | |
" * @default {}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Set component state": { | |
"prefix": "%setstate", | |
"description": "Call set state function", | |
"body": [ | |
"this.setState(state => Object.assign({}, state, {$1}));" | |
] | |
}, | |
"Modify state": { | |
"prefix": "%modifystate", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sum extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
firstValue: "", | |
secondValue: "", | |
sumVar: "", | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
class Carousel extends React.Component { | |
render() { | |
return ( | |
<> | |
<h1>{this.props.product}</h1> | |
</> | |
); | |
} |
Debug a project accessed from a remote device.This device should be connected to your local machine via usb.
To be able to access your local project from a remote device, you might serve it on the 0.0.0.0 host:
npm start -- --host 0.0.0.0