- Документация по
React.memo: https://reactjs.org/docs/react-api.html#reactmemo - Документация по
useState: https://reactjs.org/docs/hooks-reference.html#usestate - Исходный код
ReactFiberBeginWork: https://github.com/facebook/react/blob/56e9feead0f91075ba0a4f725c9e4e343bca1c67/packages/react-reconciler/src/ReactFiberBeginWork.new.js#L3219 - React.js pure render performance anti-pattern: https://medium.com/@esamatti/react-js-pure-render-performance-anti-pattern-fb88c101332f
- Avoiding unnecessary renders with React context: https://frontarm.com/james-k-nelson/react-context-performance/
- The Secret parts of React New Context API: https://medium.com/@koba04/a-secret-parts-of-react-new-context-api-e9506a4578aa
- Why Did You Render: https://www.npmjs.com/package/@welldone-software/why-did-you-render
| |- (p -> r) | (q -> r) -> (p & q -> r) | |
| --- | |
| (p -> r) | (q -> r) |- p & q -> r | |
| --- | |
| (p -> r) | (q -> r), p & q |- r | |
| --- | |
| (p -> r) | (q -> r), p, q |- r | |
| ---1-1 | |
| p -> r, p, q |- r | |
| --- |
| const express = require("express"); | |
| const app = express(); | |
| var session = require('express-session'); | |
| const fetch = require('node-fetch'); | |
| const clientID = process.env.CLIENT_ID; | |
| const clientSecret = process.env.CLIENT_SECRET; | |
| async function getAccessToken(code, client_id, client_secret) { | |
| const request = await fetch("https://github.com/login/oauth/access_token", { |
| type FiberFunction<Args extends any[], Return> = ( | |
| cell: CellFunction | |
| ) => (...args: Args) => Return; | |
| type FiberInstance<Args extends any[], Return> = ( | |
| ...args: Args | |
| ) => [Return, FiberInstance<Args, Return>]; | |
| type FiberFactory = <Args extends any[], Return>( | |
| fiber: FiberFunction<Args, Return>, |
This is the base of all projects and it will include the foundation for all potential react-based projects in Reason.
This base package should include a ReasonReact api to promote collaboration and familiarity with people using a ReasonReact, and for the modern world of React this should also include a Hooks api that currently revery uses.
All blocks in Jsx are of type React.reactElement. This reactElement should represent:
| function getListMiddle(head){ | |
| let slow = head; | |
| let fast = head; | |
| let moveBoth = false; | |
| // to get second element, in case of two mid-nodes, use 'fast' instead of 'fast.next' | |
| while(fast.next){ | |
| if(moveBoth){ | |
| slow = slow.next; | |
| fast = fast.next; |
I started using React 3.5 years ago, and I still love it. It was such a well-designed solution that not much has changed since then, only superficial stuff like naming. What I learned then is still wholly applicable today because it's such a good idea (although now you can choose from many other libraries). On top of that, we now benefit from an entirely new architecture (fiber) without changing much.
| function AHashtable(size) { | |
| this.table = this.init_table(size); | |
| } | |
| AHashtable.prototype.set = function(key, value) { | |
| var self = this; | |
| var index = self.jenkins_hash(key, self.table.length); | |
| self.table[index] = value; | |
| }; |
| 'use strict'; | |
| function BinarySearchTree() { | |
| this.root = null; | |
| } | |
| BinarySearchTree.prototype.insertNode = function (val) { | |
| var node = { | |
| data : val, |
| var HashTable = function() { | |
| this._storage = []; | |
| this._count = 0; | |
| this._limit = 8; | |
| } | |
| HashTable.prototype.insert = function(key, value) { | |
| //create an index for our storage location by passing it through our hashing function | |
| var index = this.hashFunc(key, this._limit); |