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"; | |
| const RenderCount = () => { | |
| const renders = React.useRef(0); | |
| return ( | |
| <> | |
| <i className="circle">{++renders.current}</i> | |
| <style jsx>{` | |
| .circle { | |
| position: absolute; |
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, { useState, useCallback, memo } from 'react'; | |
| const ArrayOfLines = [ | |
| { id: 0, name: 'Lorem ipsum' }, | |
| { id: 1, name: 'Dolor sit' }, | |
| { id: 2, name: 'Consectetuer' }, | |
| { id: 3, name: 'Adipiscing elit' }, | |
| { id: 4, name: 'Diam' }, | |
| { id: 5, name: 'Nonummy nibh' }, | |
| { id: 6, name: 'Tincidunt' }, |
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' | |
| import useSWR from 'swr' | |
| const Profile = () => { | |
| const later = (delay, value) => new Promise(resolve => setTimeout(resolve, delay, value)); | |
| const fetcher = url => | |
| fetch(url) | |
| .then(resp => resp.json()) | |
| .then((data) => later(5000, data)) |
NewerOlder