Skip to content

Commit

Permalink
restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoonz committed Mar 11, 2022
1 parent 5268428 commit 28d1f56
Show file tree
Hide file tree
Showing 355 changed files with 2,052 additions and 16,214 deletions.
18 changes: 9 additions & 9 deletions docs/content/cheat-sheets/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ React.createElement(
)

// Clone and return a new React element using element as the starting point.
// The resulting element will have the original elements props with the new props merged in shallowly.
// The resulting element will have the original element's props with the new props merged in shallowly.
React.cloneElement(
element,
[ props ],
Expand Down Expand Up @@ -97,7 +97,7 @@ class Component extends React.Component {
this.state = {
active: true,

// In rare cases, its okay to initialize state based on props.
// In rare cases, it's okay to initialize state based on props.
// This effectively “forks” the props and sets the state with the initial props.
// If you “fork” props by using them for state, you might also want to implement componentWillReceiveProps(nextProps)
// to keep the state up-to-date with them. But lifting state up is often easier and less bug-prone.
Expand All @@ -120,15 +120,15 @@ class Component extends React.Component {
// Invoked immediately after a component is mounted.
// Initialization that requires DOM nodes should go here.
// If you need to load data from a remote endpoint, this is a good place to instantiate the network request.
// This method is a good place to set up any subscriptions. If you do that, dont forget to unsubscribe in componentWillUnmount().
// This method is a good place to set up any subscriptions. If you do that, don't forget to unsubscribe in componentWillUnmount().
componentDidMount() {}

// Invoked before a mounted component receives new props.
// If you need to update the state in response to prop changes (for example, to reset it),
// you may compare this.props and nextProps and perform state transitions using this.setState() in this method.
componentWillReceiveProps( nextProps ) {}

// Let React know if a components output is not affected by the current change in state or props.
// Let React know if a component's output is not affected by the current change in state or props.
// The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior.
// shouldComponentUpdate() is invoked before rendering when new props or state are being received. Defaults to true.
// This method is not called for the initial render or when forceUpdate() is used.
Expand Down Expand Up @@ -159,7 +159,7 @@ class Component extends React.Component {

// This method is required.
// It should be pure, meaning that it does not modify component state,
// it returns the same result each time its invoked, and
// it returns the same result each time it's invoked, and
// it does not directly interact with the browser (use lifecycle methods for this)
// It must return one of the following types: react elements, string and numbers, portals, null or booleans.
render() {
Expand All @@ -168,7 +168,7 @@ class Component extends React.Component {

// Contains data specific to this component that may change over time.
// The state is user-defined, and it should be a plain JavaScript object.
// If you dont use it in render(), it shouldnt be in the state.
// If you don't use it in render(), it shouldn't be in the state.
// For example, you can put timer IDs directly on the instance.
// Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made.
// Treat this.state as if it were immutable.
Expand All @@ -195,7 +195,7 @@ Component.defaultProps = {

component = new Component();

// By default, when your components state or props change, your component will re-render.
// By default, when your component's state or props change, your component will re-render.
// If your render() method depends on some other data, you can tell React that the component needs re-rendering by calling forceUpdate().
// Normally you should try to avoid all uses of forceUpdate() and only read from this.props and this.state in render().
component.forceUpdate( callback )
Expand Down Expand Up @@ -250,7 +250,7 @@ ReactDOM.createPortal( child, container )
// request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
ReactDOMServer.renderToString( element )

// Similar to renderToString, except this doesnt create extra DOM attributes that React uses
// Similar to renderToString, except this doesn't create extra DOM attributes that React uses
// internally, such as data-reactroot. This is useful if you want to use React as a simple static
// page generator, as stripping away the extra attributes can save some bytes.
ReactDOMServer.renderToStaticMarkup( element )
Expand All @@ -261,7 +261,7 @@ ReactDOMServer.renderToStaticMarkup( element )
// request for faster page loads and to allow search engines to crawl your pages for SEO purposes.
ReactDOMServer.renderToNodeStream( element )

// Similar to renderToNodeStream, except this doesnt create extra DOM attributes that React uses
// Similar to renderToNodeStream, except this doesn't create extra DOM attributes that React uses
// internally, such as data-reactroot. This is useful if you want to use React as a simple static
// page generator, as stripping away the extra attributes can save some bytes.
ReactDOMServer.renderToStaticNodeStream( element )
Expand Down
10 changes: 5 additions & 5 deletions docs/content/html-docs/-eeddcbbfce.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions docs/content/html-docs/29107295-e9457ed2135dcbbf6ce8.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions docs/content/html-docs/commons-5965a56c7b6ef2e118ee.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/content/html-docs/commons-acbefeee.js

Large diffs are not rendered by default.

Loading

0 comments on commit 28d1f56

Please sign in to comment.