import React, { Component, PropTypes } from 'react';
export default function connectToStores(reducer) {
return function(DecoratedComponent) {
return class ConnectToStoresWrapper extends Component {
static contextTypes = { flux: PropTypes.object.isRequired }
PkMn Identifier EvolvesFrom EvolvesTo EvoChainID EvoStage EvolutionPips BaseStamina BaseAttack BaseDefense Type1 Type2 BaseCaptureRate BaseFleeRate CollisionRadiusM CollisionHeightM CollisionHeadRadiusM MovementType MovementTimerS JumpTimeS AttackTimerS QuickMoves CinematicMoves PokemonClass PokedexHeightM PokedexWeightKg HeightStdDev WeightStdDev CandyFamily CandyToEvolve AnimTime | |
1 Bulbasaur 0 Ivysaur 1 1 NORMAL 90 126 126 GRASS POISON 0,16 0,10 0,38 0,65 0,27 JUMP 10,00 1,15 29,00 Vine Whip, Tackle Sludge Bomb, Seed Bomb, Power Whip 1,00 0,70 6,90 0,09 0,86 001_BULBASAUR 25 6d56d53fdaac2a3f6d56d53f93a9ea3f0000000036ab0a403333b33fbfbbbb3f | |
2 Ivysaur Bulbasaur Venusaur 1 2 NORMAL 120 156 158 GRASS POISON 0,08 0,07 0,32 0,64 0,25 JUMP 23,00 1,50 8,00 Razor Leaf, Vine Whip Sludge Bomb, Solar Beam, Power Whip 1,00 1,00 13,00 0,13 1,63 001_BULBASAUR 100 36ab2a40daac2a3f6d56d53f36ab0a4000000000000000406d56d53fdbdddd3f | |
3 Venusaur Ivysaur 0 1 3 NORMAL 160 198 200 GRASS POISON 0,04 0,05 0,76 1,03 0,38 JUMP 11,00 1,25 |
PkMn BaseStamina BaseAttack BaseDefense Type1 Type2 BaseCaptureRate BaseFleeRate CollisionRadiusM CollisionHeightM CollisionHeadRadiusM MovementType MovementTimerS JumpTimeS AttackTimerS QuickMoves CinematicMoves AnimTime Evolution EvolutionPips PokemonClass PokedexHeightM PokedexWeightKg HeightStdDev WeightStdDev FamilyId CandyToEvolve | |
1 90 126 126 HoloPokemonType.POKEMON_TYPE_GRASS HoloPokemonType.POKEMON_TYPE_POISON 0.1599999964237213 0.10000000149011612 0.3815000057220459 0.6539999842643738 0.27250000834465027 HoloPokemonMovementType.POKEMON_ENC_MOVEMENT_JUMP 10.0 1.149999976158142 29.0 d601dd01 5a3b76 6d56d53fdaac2a3f6d56d53f93a9ea3f0000000036ab0a403333b33fbfbbbb3f 02 HoloPokemonClass.POKEMON_CLASS_NORMAL 1 0.699999988079071 6.900000095367432 0.08749999850988388 0.862500011920929 HoloPokemonFamilyId.V0001_FAMILY_BULBASAUR 25 | |
2 120 156 158 HoloPokemonType.POKEMON_TYPE_GRASS HoloPokemonType.POKEMON_TYPE_POISON 0.07999999821186066 0.07000000029802322 0.3187499940395355 0.637499988079071 0.2549999952316284 H |
#!/bin/bash | |
# Make the script fail on the first error encountered. | |
set -euo pipefail | |
# Create a temp folder that we can use to store files in. | |
if [ "$(uname -s)" = "Darwin" ]; then | |
tmp_dir=$(mktemp -d -t find-dead-modules.XXXXXXXX) | |
else | |
tmp_dir=$(mktemp -d --tmpdir find-dead-modules.XXXXXXXX) |
// ------------ | |
// counterStore.js | |
// ------------ | |
import { | |
INCREMENT_COUNTER, | |
DECREMENT_COUNTER | |
} from '../constants/ActionTypes'; | |
const initialState = { counter: 0 }; |
So I built an algorithm that tries to lose tictactoe no matter what. If you'd like to battle your algorithm against mine, I think it would be fun. This is the spec of what your server should accept & return. If you built an algorithm that can beat it, please tweet me @bunsen.
Your server should accept GET requests with the following parameters:
row
col
mark
grid
- will be a url encoded array, like this:[["x",%20"x",%20nil],%20[nil,%20nil,%20"o"],%20[nil,%20"o",%20nil]]
It should return JSON that looks like this:
/** | |
* Stores are just seed + reduce function. | |
* Notice they are plain objects and don't own the state. | |
*/ | |
const countUpStore = { | |
seed: { | |
counter: 0 | |
}, | |
reduce(state, action) { |
Note: if you want to skip history behind this, and just looking for final result see: rx-react-container
When I just started using RxJS with React, I was subscribing to observables in componentDidMount
and disposing subscriptions at componentWillUnmount
.
But, soon I realised that it is not fun to do all that subscriptions(that are just updating property in component state) manually, and written mixin for this...
Later I have rewritten it as "high order component" and added possibility to pass also obsarvers that will receive events from component.
Consider it a given that this talks to a RESTful API (simple crud and, in my case, predicate filtering).
There is a FetchStore
that manages the API calls, ensuring there aren't duplicate calls, resolving promises once data arrives, etc. The store itself is rather opaque. It doesn't have any public accessors.
The FetchActions
defines two actions for clients to call, and two for other stores to consume in the dispatch cycle:
import alt from './alt'
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |