View react-redux.flow.js
/** @flow */
import type { Dispatch, Store } from 'redux';
declare module 'react-redux' {
/*
S = State
A = Action
AS = AppState
View redux-first-article-code.js
routesMap: {
HOME: '/',
POST: '/feed/post/:id',
USER: '/users/:slug',
}
which I'm sure you're familiar with. But then what you can do is this:
store.dispatch({ type: 'HOME' })
View webpack-magic-comments-usage.js
export default webpackStats => (req, res) => {
const appString = ReactDOM.renderToString(<App />)
const chunkNames = flushChunkNames()
const assets = webpackStats.assetsByChunkName
const filesForChunk = chunk => assets[chunk]
const files = flatten(chunkNames.map(filesForChunk))
const scripts = files.filter(f => f.endsWith('.js'))
const stylesheets = files.filter(f => f.endsWith('.css'))
View createLocationReducer.js
// @flow
import { NOT_FOUND } from '../index'
import isServer from '../pure-utils/isServer'
import { nestHistory } from '../pure-utils/nestAction'
import type {
LocationState,
RoutesMap,
Action,
Payload,
History
View redux-middleware-test.js
a = next => action => { console.log('a1'); action = next(action+'A'); console.log('a2'); return action+'a' }
b = next => action => { console.log('b1'); action = next(action+'B'); console.log('b2'); return action+'b' }
c = next => action => { console.log('c1'); action = next(action+'C'); console.log('c2'); return action+'c' }
funcs = [a, b, c]
dispatch = funcs.reduce((a, b) => (...args) => a(b(...args)))(action => { console.log('BEFORE'); return action; })
dispatch('FOO')
a = next => { console.log('A ACTION'); return (action) => { console.log('a1'); action = next(action+'A'); console.log('a2'); return action+'a'; }; }
b = next => { console.log('B ACTION'); return (action) => { console.log('b1'); action = next(action+'B'); console.log('b2'); return action+'b'; }; }
View pure-redux-router-route-group.js
import React from 'react';
import isEqual from 'lodash/isEqual';
function RouteTransitionGroup() {
let {children, location} = this.props;
let {type, payload, pathname} = location;
children = React.Children.toArray(children)
.filter(child => isChildMatch(child, location));
View rnw.stylesheet.index.js
import * as css from './css';
import createReactStyleObject from './createReactStyleObject';
import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
import flattenStyle from '../../modules/flattenStyle';
import React from 'react';
import ReactNativePropRegistry from '../../modules/ReactNativePropRegistry';
import StyleSheetValidation from './StyleSheetValidation';
import jss from 'jss'
import preset from 'jss-preset-default'
View ImageAlternative.js
import React, { Component } from 'react'
import {
View,
ActivityIndicator,
StyleSheet,
} from 'react-native'
export default class Image extends Component {
View AnimatedComponent.js
import React, { Component } from 'react';
import {
Text,
View,
Image,
Animated,
Easing,
} from 'react-native';
const ALL_PROPERTIES = ['translateX', 'translateY', 'translateZ', 'rotateX', 'rotateY', 'rotateZ', 'scale'];
View meteor-accounts-twitter-auth.js
const Twit = Meteor.npmRequire('twit');
Accounts.registerLoginHandler('twitter', function(params) {
const data = params.twitter;
// If this isn't twitter login then we don't care about it. No need to proceed.
if (!data) {
return undefined;
}