Minimal loader with state management capabilities.
Checkout out the demo.
Make sure to add a .babelrc
file:
import Maybe from 'folktale/maybe'; | |
const Inc = 'Inc'; | |
const Dec = 'Dec'; | |
const IncBy = 'IncBy'; | |
const IncFn = state => state + 1; | |
const DecFn = state => state - 1; | |
const IncByFn = (state, action) => state + action.incBy; |
// @flow | |
import React from 'react'; | |
import { render } from 'react-dom'; | |
type Field = 0 | 1; | |
type Position = [Field, Field, Field, Field]; | |
type Unit = [Position, Position, Position, Position]; |
type field = | |
| O | |
| X; | |
type position = (field, field, field, field); | |
type unit = (position, position, position, position); | |
type units = list(unit); |
import React from 'react'; | |
import daggy from 'daggy'; | |
// Inspired by: | |
// "Slaying a UI Antipattern in Fantasyland" @thinkfunctional | |
// https://medium.com/javascript-inside/slaying-a-ui-antipattern-in-fantasyland-907cbc322d2a | |
// "Use a Render Prop!" | |
// https://cdb.reacttraining.com/use-a-render-prop-50de598f11ce @mjackson |
const fakeFetch = () => | |
new Promise((res, rej) => { | |
setTimeout( | |
() => | |
res([ | |
{ id: 1, name: 'foo' }, | |
{ id: 2, name: 'bar' }, | |
{ id: 3, name: 'baz' } | |
]), | |
1000 |
let se = ReasonReact.stringToElement; | |
type state = int; | |
type actions = | |
| Inc | |
| IncWithSideEffect | |
| SideEffect | |
| DoNothing | |
| SilentIncUpdate |
Minimal loader with state management capabilities.
Checkout out the demo.
Make sure to add a .babelrc
file:
Intended for developers interested in getting started with Flow. At the end of this introduction, you should have a solid understanding of Flow and how to apply it when building an application.
Covers all the basics needed to get started with Flow.
Covers all the basic needed to get started with Flow and ReactJS.
// | |
// MIT License | |
// | |
// Copyright (c) 2018 Ali Sharif | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
// | |
// MIT License | |
// | |
// Copyright (c) 2018 Ali Sharif | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |