made with esnextbin
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 counterA(state = 0, action) { | |
| switch (action.type) { | |
| case 'increment': | |
| return state + 1 | |
| case 'decrement': | |
| return state - 1 | |
| default: | |
| return state | |
| } | |
| } |
made with esnextbin
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, { Component } from 'react' | |
| import Subapp from './subapp/Root' | |
| class BigApp extends Component { | |
| render() { | |
| return ( | |
| <div> | |
| <Subapp /> | |
| <Subapp /> | |
| <Subapp /> |
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
| // While I claim this is a drop-in replacement, it is a little bit slower. | |
| // If you have hundreds of links, you might spend a few more milliseconds rendering the page on transitions. | |
| // KNOWN ISSUES WITH THIS APPROACH: | |
| // * This doesn't work great if you animate route changes with <TransitionGroup> | |
| // because the links are going to get updated immediately during the animation. | |
| // * This might still not update the <Link> correctly for async routes, | |
| // as explained in https://github.com/reactjs/react-router/issues/470#issuecomment-217010985. |
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 fish_prompt | |
| set_color FF0 | |
| echo -n (basename $PWD) | |
| set_color normal | |
| echo -n $normal ') ' | |
| end |
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
| // connect() is a function that injects Redux-related props into your component. | |
| // You can inject data and callbacks that change that data by dispatching actions. | |
| function connect(mapStateToProps, mapDispatchToProps) { | |
| // It lets us inject component as the last step so people can use it as a decorator. | |
| // Generally you don't need to worry about it. | |
| return function (WrappedComponent) { | |
| // It returns a component | |
| return class extends React.Component { | |
| render() { | |
| return ( |
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
| // change this file | |
| module.exports = 42 |
Some links to point people to when they misinterpret PATENTS clause or spread false claims.
https://code.facebook.com/license-faq
https://wptavern.com/automattic-will-continue-to-use-react-js-in-calypso-despite-patent-clause
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 Boundary extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { err: null }; | |
| } | |
| unstable_handleError(err) { | |
| report(err); | |
| this.setState({ err }) | |
| } |