(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// Enable component-scanning and auto-configuration with @SpringBootApplication Annotation | |
// It combines @Configuration + @ComponentScan + @EnableAutoConfiguration | |
@SpringBootApplication | |
public class FooApplication { | |
public static void main(String[] args) { | |
// Bootstrap the application | |
SpringApplication.run(FooApplication.class, args); | |
} | |
} |
// This is an advanced example! It is not intended for use in application code. | |
// Libraries like Relay may make use of this technique to save some time on low-end mobile devices. | |
// Most components should just initiate async requests in componentDidMount. | |
class ExampleComponent extends React.Component { | |
_hasUnmounted = false; | |
state = { | |
externalData: null, | |
}; |
Picking the right architecture = Picking the right battles + Managing trade-offs
// The classic AJAX call - dispatch before the request, and after it comes back | |
function myThunkActionCreator(someValue) { | |
return (dispatch, getState) => { | |
dispatch({type : "REQUEST_STARTED"}); | |
myAjaxLib.post("/someEndpoint", {data : someValue}) | |
.then( | |
response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}), | |
error => dispatch({type : "REQUEST_FAILED", error : error}) | |
); |
class ProgressiveImage extends React.Component { | |
constructor(props) { | |
super(props); | |
this.placeholderAnimated = new Animated.Value(0); | |
this.imageAnimated = new Animated.Value(0); | |
} | |
handlePlaceholderLoad = () => { | |
Animated.timing(this.placeholderAnimated, { | |
toValue: 1 |
import React, { Component } from 'react'; | |
// Create a context first of all // | |
const MyContext = React.createContext(); | |
// Make a component class which returns the context using a provider // | |
class MyContextProvider extends Component { | |
constructor(props) { | |
super(props); |