This file contains 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 { useState } from "react"; | |
export default function CounterWithMutationTracking() { | |
const [state, setState] = useState(0); | |
let x = []; | |
let y = x; | |
y.push(state); | |
return ( |
This file contains 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
PASS packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js (18.995 s) | |
● Console | |
console.group | |
⚛️ commit (0b0000000000000000000000000000001) | |
at console.log (packages/react-reconciler/src/DebugTracing.js:51:27) | |
console.group | |
⚛️ commit (0b0000000000000000000000000000001) |
This file contains 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
// Somewhere, the Redux store needs to be wrapped in a mutable source object... | |
const mutableSource = createMutableSource( | |
relayEnvironment, | |
// Because the state is immutable, it can be used as the "version". | |
() => relayEnvironment.getVersion() | |
); | |
// It would probably be shared via the Context API... | |
const MutableSourceContext = createContext(mutableSource); |
This file contains 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 DelayedQueryRenderer extends Component { | |
constructor(props, context) { | |
super(props, context); | |
this.state = {query: null}; // don't fetch anything initially | |
} | |
componentDidMount() { | |
this.setState({query: this.props.query}); // fetch after mount | |
} | |
componentWillReceiveProps(nextProps) { | |
this.setState({query: nextProps.query}); |
This file contains 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 MyComponent extends React.Component { | |
render() { | |
return ( | |
<div className="user-profile"> | |
<img src={this.props.user.thumbnail} /> | |
<h1>{this.props.user.name}</h1> | |
</div> | |
); | |
} | |
} |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am josephsavona on github. | |
* I am joesavona (https://keybase.io/joesavona) on keybase. | |
* I have a public key whose fingerprint is 71DA 232F A47B 8A97 6EF6 141D 9A6D 5124 7BE8 A8B3 | |
To claim this, I am signing this object: |