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 buttonHtml = ` | |
<a id="thanos" class="btn btn-primary float-right" role="button" | |
style="margin-left:38px"> | |
Decimate issues | |
</a>`; | |
var css = '#thanos:hover{ background-image: linear-gradient(-180deg,#6d3678,#693270 90%) }'; | |
var style = document.createElement('style'); |
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 { globalHistory } from "@reach/router" | |
import Zoom from "./Zoom" | |
import Slide from "./Slide" | |
import Pre from "./Pre" | |
import Clock from "./Clock" | |
// based on https://github.com/streamich/react-use/blob/master/src/useSpring.ts | |
import { SpringSystem } from "rebound" | |
import { useState, useEffect } from "react" |
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
{ | |
"presets": ["@babel/preset-react", "@babel/preset-env"] | |
} |
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 lazyWithPreload(factory) { | |
const Component = React.lazy(factory); | |
Component.preload = factory; | |
return Component; | |
} | |
const StockChart = lazyWithPreload(() => import("./StockChart")); | |
// somewhere in your component | |
... |
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 App extends React.Component { | |
state = { | |
selectedStock: null | |
}; | |
render() { | |
const { stocks } = this.props; | |
const { selectedStock } = this.state; | |
return ( | |
<React.Suspense fallback={<div>Loading...</div>}> | |
<StockTable |
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 stockChartPromise = import("./StockChart"); | |
const StockChart = React.lazy(() => stockChartPromise); |
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
{ | |
"presets": ["@babel/preset-react", "@babel/preset-env"] | |
} |
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 StockTable from "./StockTable"; | |
import StockChart from "./StockChart"; | |
class App extends React.Component { | |
state = { | |
selectedStock: null | |
}; | |
render() { |
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 ReactDOM from "react-dom"; | |
import fetchWithCache from "./cache"; | |
function Post({ postId }) { | |
const post = fetchWithCache( | |
"https://jsonplaceholder.typicode.com/posts/" + postId | |
); | |
return ( | |
<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
import React from "react"; | |
import ReactDOM from "react-dom"; | |
class Post extends React.Component { | |
state = { | |
loading: true, | |
post: null | |
}; | |
componentDidMount() { | |
const { postId } = this.props; |