Skip to content

Instantly share code, notes, and snippets.

@3douhao
3douhao / The Rules.md
Created March 27, 2021 10:35 — forked from sebmarkbage/The Rules.md
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@3douhao
3douhao / remove-node-modules.md
Created February 22, 2021 05:00 — forked from lmcneel/remove-node-modules.md
How to remove node_modules after they have been added to a repo

How to remove node_modules

  1. Create a .gitignore file in the git repository if it does not contain one

touch .gitignore

  1. Open up the .gitignore and add the following line to the file

**/node_modules

@3douhao
3douhao / abc.js
Created April 23, 2020 08:21
Created with Copy to Gist
class Square extends React.Component {
render() {
return (
<button className="square">
{this.props.value}
</button>
);
}
}
@3douhao
3douhao / 1587629667.js
Created April 23, 2020 08:14
Created with Copy to Gist
return React.createElement('div', {className: 'shopping-list'},
React.createElement('h1', /* ... h1 children ... */),
React.createElement('ul', /* ... ul children ... */)
);
@3douhao
3douhao / 1587629578.js
Created April 23, 2020 08:13
Created with Copy to Gist
class ShoppingList extends React.Component {
render() {
return (
<div className="shopping-list">
<h1>Shopping List for {this.props.name}</h1>
<ul>
<li>Instagram</li>
<li>WhatsApp</li>
<li>Oculus</li>
</ul>
@3douhao
3douhao / list.md
Last active April 23, 2020 07:56
todo list
  • a task list item
  • list syntax required
  • normal formatting, @mentions, #1234 refs
  • incomplete
  • completed
@3douhao
3douhao / list.md
Created April 23, 2020 07:55
todo list
  • a task list item
  • list syntax required
  • normal formatting, @mentions, #1234 refs
  • incomplete
  • completed