Editor’s note: This article was last updated by Piyush Sinha on 10 May 2023 to update code for readability and include information about handling async logic using redux-thunk. Although Redux is a common preference for managing state in a React application, it’s important to acknowledge that configuring Redux with its boilerplate code can be a tedious and frustrating process. The Redux team came u
背景 Reduxはステート管理ライブラリとして知られているが、ミドルウェアという機能で色々と拡張できる。(例えばredux-thunkでthunkをdispatchしたり) しかし、それってステート管理ライブラリじゃなくない? と思った。ステートに書き込む以外の部分は全てむしろメッセージパッシングライブラリなのでは? ということは、Reduxのステート管理以外のユースケースを別のいい感じのライブラリに切り出すことで、例えばRecoilなどと組み合わせられるいい感じのメッセージパッシングライブラリになるのではないか。 ということで、Reduxのステート管理以外のユースケースを集めるためにスクラップを作った。 方針 自分が気が向いたときに追記しますが、Reduxのユースケースに詳しくないのでみなさんが好き勝手に書き込むのも歓迎します。
注意 この記事に書いてあることは古い情報になっている可能性があります 最近ReduxToolkit周りの進化がめざましく、更に追加されたReduxのドキュメントの項目がかなりわかりやすく書かれているため、基本的にこちらを推奨します 既にRTKなどの概要を知っているひとは特に Tutorials > Redux Essentials のセクションを読んでほしいです こんにちは、すずです Reactを使い始めて2年半経ち、その間に3つのサービス(SPA)を立ち上げてきました その経験から、 React や Redux を実務でしっかり使ってく上でのノウハウを紹介していきます (この記事ではある程度ReactやReduxの記事・ドキュメントを読んだ初学者を対象としています) 序 フロントエンド、モノを作ったはいいものの、「変更しづらい」「スケールしない」「この作りではパフォーマンスが出ない」って
本書では、Clean Architecture の観点から、React や Redux で構築されたアプリケーションの設計をとらえなおし、また、ときには新たな設計の提案を行います。 いままでは Clean Architecture があまり取り入れられてこなかった Web フロントエンド領域に対して、この手法を適用することを目指します。 本書が、React アプリケーション設計のその一歩先に到るための一助になれば幸いです。 試し読み:https://note.com/imamori/n/n5a7ebdbd4260 また、BOOTH でも販売しています。下記のページから購入できます。 BOOTH:https://archived-tech.booth.pm/items/2399644 英語版:https://www.amazon.co.jp/dp/B09FG94392 目次: 第1章 Cle
Building an Undo and Redo functionality into an app has traditionally required conscious effort from the developer. It is not an easy problem with classical MVC frameworks because you need to keep track of every past state by cloning all relevant models. In addition, you need to be mindful of the undo stack because the user-initiated changes should be undoable. This means that implementing Undo an
TypeScriptでReactをやるときは、小さいアプリでもReduxを最初から使ってもいいかもねというお話 前日の丸野さんがReduxを分かりやすく解説してみたというReduxの基本的な紹介を行いました。Reduxはコンパクトなライブラリながらよく考えられた仕組みです。Jetpack ComposeやらFlutterやら、ReactインスパイアなGUIフレームワークも増えているので、JavaScript(TypeScriptではなく) + Reduxをやってみるのは、ウェブに限らず、今後のユーザーインタフェース関連のコードを触るための理解力向上には良いと思います。 本エントリーは、プロダクションコードでたくさんRedux周りにもreducerなどを実装しなくてはいけなくなったときの次のステップとして、Redux Toolkitの紹介をします。 たいてい、Reduxは導入コストが大きく、
Follow on FacebookSince React Hooks have been released, function components can use state and side-effects. There are two hooks that are used for modern state management in React (useState and useReducer) and one hook called useContext to use React's Context API to pass state or state updater functions down the component tree. Now, many people keep wondering: Does useContext and useReducer replace
Whilst learning Redux I've came across Reducers. The documentation states: The reducer is a pure function that takes the previous state and an action, and returns the next state. (previousState, action) => newState. It's called a reducer because it's the type of function you would pass to Array.prototype.reduce(reducer, ?initialValue) . MDN describes the reduce method as: The reduce() method appli
{ domainData1 : {}, domainData2 : {}, appState1 : {}, appState2 : {}, ui : { uiState1 : {}, uiState2 : {}, } } ref: Basic Reducer Structure and State Shape · Redux 正規化 Recipesでは正規化についても言及しており、リレーショナルデータを管理する場合はデータベースのように正規化することを推奨していました。 以下は投稿が複数のコメントを持つ例です。postsはcommentsのidだけを持っています。 { posts : { byId : { "post1" : { id : "post1", author : "user1", body : "......", comments : ["comment1", "comment
Eureka EngineeringLearn about Eureka’s engineering efforts, product developments and more.
Follow on FacebookIn the beginning of 2016 it was time for me to deep dive into the ReactJs world. I read tons of articles about React and its environment, especially Redux, so far. Several of my colleagues used it in side projects and on a theoretical level I could participate in the discussions. In my company we relied heavily on Angular 1 at this point. Since we are using it in a quite large co
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く