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
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
Thanks to Max Stoiber for his blog
Thanks to Max Stoiber for his blog
>Note: I didnt get as successfull snapshot as followed from blog. So I tweaked it to make it work
Unit tests for react-redux using Jest, Enzyme.
In-depth explanations for synchronus action creators, reducers and asynchronus action creators
Note : I think .md file doesnt support JSX syntaxs and rendering rest of js code wierdly, so i used open and close tags for the JSX elements. In real code we used single tag syntax.
This project was generated using Express.js
This guide developed based on cordova-create-react-app
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
// React wrapper for lozad.js for images | |
import * as React from 'react'; | |
import * as lozad from 'lozad'; | |
// src: the image path that will be lazyloaded | |
// customClass: css class that will be applied to img element | |
// defaultImageSrc: image path (preferebly local to this app) that needs to be displayed | |
// by default before the required imgae lazy loaded | |
interface LozadWrapperProps { |
data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D"http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" viewBox%3D"0 0 228.5 127.22"%2F%3E
- 228.5 represents width
- 127.22 respresents height
- height and width preserve aspect ratio.
- more info
OlderNewer