Homebrew is a package management system for OS X. You can read more about it here, or simply run
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"to install it.
| import React from 'react'; | |
| type Mutable<T> = { | |
| -readonly [k in keyof T]: T[k]; | |
| }; | |
| const mergeRefs = <T>(...refs: React.Ref<T>[]) => (value: T): void => { | |
| for (let i = 0; i < refs.length; i += 1) { | |
| const ref = refs[i]; |
Homebrew is a package management system for OS X. You can read more about it here, or simply run
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"to install it.
| { | |
| "presets": [ | |
| "@babel/preset-env", | |
| "@babel/preset-react" | |
| ], | |
| "plugins": [ | |
| "@babel/plugin-proposal-class-properties", | |
| "dynamic-import-node", | |
| "react-loadable/babel" | |
| ] |
| /* | |
| * Spiral Matrix | |
| * @function toSpiral | |
| * @description Outputs 2 dimensional matrix in spiral sequence | |
| * @example | |
| * const matrix = [[1, 2, 3],[4, 5, 6],[7, 8, 9]] | |
| * @param {Array} matrix - 2 dimensional matrix | |
| * @return {Array} given matrix in spiral order | |
| */ | |
| function toSpiral(matrix) { |
| /* | |
| * Reverse sentence | |
| * @function | |
| * @description Benchmark test <http://jsben.ch/8jGJ6> | |
| * @param {String} sentence - Sentence to be reversed | |
| * @return {String} reversed sentence | |
| */ | |
| const reverse = (sentence) => sentence.split(' ').reverse().join(' '); | |
| // ------------------------------------------------------ |
| import express from 'express'; | |
| import path from 'path'; | |
| import React from 'react'; | |
| import { renderToString } from 'react-dom/server'; | |
| import Loadable from 'react-loadable'; | |
| import { getBundles } from 'react-loadable-ssr-addon'; | |
| import App from './components/App'; | |
| const manifest = require('./dist/react-loadable-ssr-addon.json'); | |
| const server = express(); |
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import Loadable from 'react-loadable'; | |
| import App from './components/App'; | |
| window.onload = () => { | |
| Loadable.preloadReady().then(() => { | |
| ReactDOM.hydrate(<App />, document.getElementById('app')); | |
| }); | |
| }; |
| import React from 'react'; | |
| export default function Title() { | |
| return ( | |
| <React.Fragment> | |
| <h1>React Server Side Render & Code Splitting</h1> | |
| <h2>identifying and loading required assets</h2> | |
| </React.Fragment> | |
| ); | |
| } |
| import React from 'react'; | |
| export default function LoremIpsum() { | |
| return ( | |
| <div> | |
| Bacon ipsum dolor amet pork belly minim pork loin reprehenderit incididunt aliquip hamburger chuck culpa mollit officia nisi pig duis. | |
| Buffalo laboris duis ullamco flank. | |
| Consectetur in excepteur elit ut aute adipisicing et tongue veniam labore dolore exercitation. | |
| Swine consectetur boudin landjaeger, t-bone pork belly laborum. |
| import React from 'react'; | |
| import Loadable from 'react-loadable'; | |
| const TitleAsync = Loadable({ | |
| loader: () => import(/* webpackChunkName: "title" */'./title'), | |
| loading() { | |
| return <div>Loading...</div> | |
| } | |
| }); |