Web アプリを構築したくて久し振りに React を触ってみると、前に少し触っていたのにすっかり忘れてしまっていました。圧倒的に記憶力が低いので、継続的に触っていないと中々覚えられません…。 今だと Angular2 がグイグイ来てたりしてますが、それよりも一度触ったことのある React+Redux を使った方が学習コストを抑えられるな、という訳で再度勉強中です。 改めて色々と調べていると、redux-sagaという Redux の Middleware が非同期処理を書きやすく出来るぞ!との事だったので、まずはシンプルなカウンターサンプルの実装をして感じを掴んでいきたいと思います。 最後の 参考 にもあげていますが、そもそも redux-saga とは一体何者なんだ?というところにおいて、以下の記事が大変参考になりました。 redux-saga で非同期処理と戦う - Qiita ま
最近redux-sagaについて調べていたのだが、用語の理解が曖昧だったので公式ドキュメントのGlossaryを雑に訳してみた。 Effect effectとはsaga middlewareによって実行される命令を含むプレーンなJavaScriptオブジェクトです。 redux-sagaライブラリが提供するファクトリ関数を使うことでeffectを生成できます。 例えば、call(myfunc, 'arg1', 'arg2')が返すeffectをyieldすることによって、middlewareに対してmyfunc('arg1', 'arg2')を呼び出して結果をGeneratorに返すよう指示します。 Task taskはバックグランドで走るプロセスのようなもので、redux-sagaを使ったアプリケーションでは複数のtaskが並列に動作します。fork関数を使うと下記のようにtaskを生成
Hi there 👋 My name is Joel Hooks. I'm a skilled virtual assistant, software developer, and a collaborator at egghead.io. This is my personal site where I drop notes and articles about things that I am interested in. Generally speaking this journal will capture thoughts I have about building bootstrapped business, raising kids, learning, teaching, and my endless obsession with media and gear. The
According to the docs, "Without middleware, Redux store only supports synchronous data flow". I don't understand why this is the case. Why can't the container component call the async API, and then dispatch the actions? For example, imagine a simple UI: a field and a button. When user pushes the button, the field gets populated with data from a remote server. import * as React from 'react'; import
はじめに Bitbucket BrowserというBitbucket ServerのViewerをReactで作っていて、機能追加に伴い非同期処理部分がだんだん辛くなってきたので、勉強も兼ねてredux-sagaを使ってみたらどう改善されるのか試してみた。 なお、Bitbucketにはプラグイン機構があるのでプラグインとして実装するのが王道なのだが、Bitbucketが提供するREST APIを呼び出すだけで簡易的なViewerなら十分作れそうなので、HTML/JS/CSSのみで作っている。 使用ライブラリ 細かいライブラリも含めた使用バージョンは下記のとおり。なお、アプリケーション全体はTypeScriptで書いている。 "dependencies": { "babel-polyfill": "^6.9.0", "bulma": "0.0.26", "font-awesome": "^4
In this article I share my confusion and findings about Saga pattern. I’m not an expert in Saga or any other mentioned concepts. Recently I’ve been looking into a popular JavaScript library for handling complex asynchronous data flows in React.js applications built with Redux state management library which is called redux-saga. The way it works is very much similar to CSP (Communicating Sequential
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く