Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

こんにちは。Sales Systemチームの金子です。Sales Systemチームでは、cybozu.com Store や、販売管理システム等の開発をしています。 このエントリでは、cybozu.com 稼働状況のフロントエンドをReact/Reduxで作り直した話を書いていきます。「React/ReduxでWebアプリケーションを作ってみようと考えている人」を対象としています。 TOC 「cybozu.com 稼働状況」とは? 作り直した背景 技術概要 React/Fluxについて React/Redux Routing Resources Async Multilingualization/Localization ES6 Utility Lint Testing 取り組んでみた感想 まとめ 「cybozu.com 稼働状況」とは? クラウドサービスはサービスの稼働状況をステータス
概要 React + Redux の Action についてサンプルを使って、Action の作成と動作の確認をします。 準備 redux/examples/real-world からいろいろそぎ落としたこちらのソースの tag/init を使って説明します。 ※ 実装完了はtag/action Action とは Action はストアの state を変更するためのメッセージです。 Action によって state が変わると UI の表示などアプリの変化が起きるので、アプリに何か起こすための出発点となります。 Action 発行 Reducer が現在の state と action を元に新しい state を作成。 state の変更をUIなどに反映 Action は javascipt のオブジェクトでどのような形でも大丈夫ですが、慣習として type フィールドに文字列で
One thing that causes even more confusion than Flux is the difference between Flux and Redux, a pattern that was inspired by Flux. In this article I’ll explain the differences between the two. If you haven’t read the last article about Flux, you should do that first. Why change Flux?Redux solves the same problems as Flux, plus some. Just like Flux, it makes state changes in apps more predictable.
概要 reduxでreducerのテストをしたく、以下の様な記事を書いた。 React+ReduxのAction、Reducerを個別にテストする - Qiita モックしたデータをstore.dispatchするという方法をとっていたが、これも、reducer実行終了時まで待つ必要があるため、タイミングを担保するのが難しい。そこで、別の方針でテストすることにした。 方針 reduxのドキュメントを参考にすると、dispatchをせず、直接reducer関数を実行している。同じように実装することにした。 Writing Tests | Redux // createReducerは以下の様なutilメソッドを用意しておく // export function createReducer (initialState, reducerMap) { // return (state = init
import { REQUEST, REQUEST_SUCCESS, } from 'constants'; import { createStoreForActionTest } from 'utils/test'; import { fetchSomeResource } from './action.js'; describe('(Action)', function() { const initialState = { items: [], isFetching: false, }; const expectedActions = [ { type: REQUEST }, { type: REQUEST_SUCCESS, items: ['items'] }, ]; it('REQUEST, REQUEST_SUCCESS が disapatch されること', (done) =>
項目が多いので React tutorial example series に分けました。 モジュールのバーッションをアップデートして、内容も少しアップグレードしています。 React Tutorial Example (Express) React Tutorial Example (Hot Module Replacement) React Tutorial Example (Redux) React Tutorial Example (ECMAScript 2015) React Tutorial Example (Convention) React Tutorial Example (PostCSS) React Tutorial Example (Package) React Tutorial Example (Jest) React Tutorial Example (Elec
youtu.be http://gmork.in/cyro/ サンプラー。 キーボードを押したら音が増える。 [A-Z] : 音を入力 Shift + [A-Z] : そのキーの音をすべて削除 / : 設定パネルの表示 / 非表示 一応ソース fand/cyro · GitHub Cycle.js / RxJS の感想 Cycle.jsとは cycle.js.org Cycle.js は Unidirectional dataflow / Model-View-Intent を実現するWebフレームワーク。 RxJS 及び virtual-dom を使って書かれており、開発者もこれらを利用することになる。 作者の André Staltz 氏は Rx オジサンで、Rx に関するサイトを幾つか作ってる。 Flux や Elm, Famous のアーキテクチャを解説した記事は少しバズったので、
概要 Reactでユニットテストをしたく、コンポーネントのテストであれば以下の様な記事を参考にすればできそうだが、Fluxをつかったアプリで、ActionやDispatcherにロジックがある時には、それでは十分で無いと考えた。 React.js + Jest - Qiita 今回はReact+Reduxを使っているので、Action、Reducerを個別にテストする方針を考えた。テストフレームワークは、karma+jasmineを使用している。 Action テストするactionは以下の様なものを想定している。単純にAPIを叩いてresを得るというもの。 import { REQUEST, REQUEST_SUCCESS, } from 'constants'; // リソース管理はsuperagent import request from 'superagent'; functio
The release of TypeSciprt 1.6 includes support for React components. I decided to give it a whirl and see what TypeScript has to offer. The end result is a port of the Redux TodoMVC example to TypeScript. (See my repo on GitHub) So why use types in the first place? Isn’t the dynamic and flexible nature of JavaScript what makes it so great in the first place? As strange as it sounds, I actually bel
React.jsと組み合わせるfluxのライブラリreduxを試してみた。 このページは作業ログです。やったことをつらつら書くだけなのでまとめません。あしからず。 対象読者 主に自分 今日のゴール redux-react-routerを使ってページ切り替えを実現する redux-react-routerとは? Reactのラウター(ルーターではない)ライブラリとしてよくreact-routerが使われる。react-routerの機能は十分だが、現在表示しているページという"状態"がアプリケーションに登場する。これもできればstoreに押し込めたい。ということで登場したライブラリ。react-routerをベースにしたライブラリなので、まずreact-routerから見ていく。 react-routerの特徴 ドキュメントの構造とURLの構造をマッピングするライブラリ。最初ドキュメントを読
I have been using Facebook’s React since v0.9.x in Feb 2014. I am a defector from Backbone.js which initially started after replacing our view layer with React. After understanding the benefits of Flux and it’s unidirectional flow architecture it became pretty evident that I did not need Backbone.js models and collections anymore. I will assume you have some basic knowledge of Flux, Redux, React,
A Comprehensive Guide to Test-First Development with Redux, React, and Immutable Update 2016-02-24: Updated react-router to 2.0.0. In tests, replaced use of deprecated setProps() with ReactDOM.render(). Also now using the react-addons-test-utils package so that no imports of 'react/addons' are needed anywhere. Update 2015-11-06: Updated to the new Babel 6 release. The Babel packages we need to ins
Principal Engineer, type system nerd, Rust enthusiast, supporter of social justice, loving husband & father, avid comic & manga reader, 日本語を勉強してる。 Home About Me @BKonkle YouTube I’m a Software Architect with more than 15 years of experience creating high performance server and front-end applications targeting web and mobile platforms, & today I lead a team at Formidable Labs. Share If you follow R
最初思ってたこと vs 現実 思ってたこと:なんか軽量? 現実:誤解だった。割りと作ってくと大きめになってくる。軽量感は無い が、redux本体のコードは結構薄い。本当に関数群だけ提供しているイメージ 思ってたこと:他のfluxと圧倒的に違う? 現実:これも誤解。構成としては色々作りこむと最終的には一般的なfluxと同じ感じになる(flummoxとかmartyあたりと体感一緒になる) ActionとかActionCreatorとかその辺が一緒になってくる。 思ってたこと:ES6で圧倒的に書ける? 現実:正解。圧倒的にES6を前提にしている。 思ってたこと:React用のもの? 現実:別にそうでもない。react-reduxを使うことでreactで使えるようになる。 詰まった所など 用語編 割りと初めて見たりする用語に出会った ActionCreator martyあたりにもあった。{typ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く