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 "./App.css"; | |
| import { useState, useDeferredValue, memo, useEffect } from "react"; | |
| import { fetchCities } from "./data/cities"; | |
| const displayCount = 1000; | |
| // code similar to example by React Team: https://github.com/reactwg/react-18/discussions/129#discussioncomment-2439125 | |
| const ListItem = ({ id, name }) => { | |
| let now = performance.now(); | |
| while (performance.now() - now < 5) { |
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 "./App.css"; | |
| import { useState, useDeferredValue, memo, useEffect } from "react"; | |
| import { fetchCities } from "./data/cities"; | |
| const displayCount = 1000; | |
| // code similar to example by React Team: https://github.com/reactwg/react-18/discussions/129#discussioncomment-2439125 | |
| const ListItem = ({ id, name }) => { | |
| let now = performance.now(); | |
| while (performance.now() - now < 5) { |
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 { fetchCities } from "../data/cities"; | |
| export function fetchCityListData(displayCount) { | |
| const cityPromise = fetchCities(displayCount); | |
| return { | |
| cities: wrapPromise(cityPromise), | |
| }; | |
| } | |
| function wrapPromise(promise) { |
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
| // Author: Peter Kellner, https://peterkellner.net | |
| import React from 'react'; | |
| class ErrorBoundary extends React.Component { | |
| state = { hasError: false }; | |
| updateHasErrorsToFalse = () => { | |
| this.setState(() => ({ | |
| hasError: false, | |
| })); |
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
| function Demo() { | |
| function ProcessAndRender() { | |
| const fetcher = (url) => fetch(url).then((r) => r.json()); | |
| const { data } = useSwr( | |
| `https://jsonplaceholder.typicode.com/todos`, | |
| fetcher, | |
| { suspense: true } | |
| ); | |
| return ( | |
| <div className="container grid"> |
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
| function Demo() { | |
| const fetcher = (url) => fetch(url).then((r) => r.json()); | |
| const { data } = useSwr( | |
| `https://jsonplaceholder.typicode.com/todos`, | |
| fetcher, | |
| { suspense: false } | |
| ); | |
| if (!data) return <div>Loading... (pre-Suspense)</div>; |
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
| const svccUiMachine = Machine({ | |
| id: 'svccUiMachine1', | |
| context: { | |
| currentCodeCampYear: '2019', | |
| codeCampYears: [ | |
| '2005', | |
| '2006', | |
| '2007', | |
| '2008', | |
| '2009', |
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
| svccUiMachine1 = Machine({ | |
| id: 'svccUiMachine1', | |
| context: { | |
| currentCodeCampYear: '2019', | |
| codeCampYears: [ | |
| '2005', | |
| '2006', | |
| '2007', | |
| '2008', | |
| '2009', |
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
| const svccUiMachine1 = Machine({ | |
| id: 'svccUiMachine1', | |
| context: { | |
| }, | |
| type: 'parallel', | |
| states: { | |
| codeCampYear: { | |
| initial: "2019", | |
| states: { |
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
| using System; | |
| using System.Collections.Generic; | |
| namespace WebAppReactCRA.GraphQL.Speakers | |
| { | |
| // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse); | |
| public class AttendeesAmazonBookDto { | |
| public int Id { get; set; } | |
| public string AmazonImageSmall { get; set; } | |
| public string BookTitle { get; set; } |