You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
みなさんこんにちは。筆者は最近Recoilを使ってロジックを記述するのにハマっています。先日はそのようなテーマでトークをしましたので、よければご覧ください。 要点は、 Recoilのselectorとかも活用しまくってロジックをどんどんRecoilに載せようぜ!! ということです。ただ、前記のイベントを観ていただいた方には分かるように、Recoilを活用していてもほとんどatomしか使っていないという場合もあり、Recoilの普及度とselectorの普及度には差があるようです。 そこで、この記事ではRecoil selectorの活用パターンを紹介します。今回は無限スクロールの実装です。 ここで想定している無限スクロールとは、次のようなものです。 サーバーから取得したデータがリストで表示されている。 ユーザーがスクロールしてリストの下に到達したら、サーバーから追加のデータを読み込んでリス
最近 React のコードリーディングに付き合ってくださる方がいらっしゃいましてコードを読んでいるのですが、読むにあたってはそもそもユーザーが書いた React がどう実行されるかエントリポイントをはっきりさせたくなりました。 たとえば const App = () => { const [state, setState] = React.useState(0); return ( <div> <p>state: {state}</p> <button onClick={() => { setState(state + 1); }} >click me</buttn> </div> ); }; のようなコードを実行したときのエントリポイントは分からないわけです。 なので JSX で書いたコードを変換かけて読む環境を作りました。 babel での変換 まず一般的に JSX は React の
React Advent Calendar 2022 2日目の記事です。 本記事はごく簡単なコンポーネントから始めて、react のレンダリングについて学び直す記事です。学び直し(!=入門記事)なので JSX、TS の説明などはしません。 本記事の対象読者 ある程度 react を触っていて、もっとレンダリングについて理解したい人 より良いコンポーネントを書きたい人 本記事のコードについて 特に断らないかぎり、本記事に出てくるコードは以下のコードを省略したものです。実際に動かせる codesandbox も用意したので、そちらも参照ください。 import { createRoot } from 'react-dom/client'; const App = /* 実装 */; createRoot(document.querySelector('#main')).render(<App
useEffect とは何か、ご存知ですか? useEffect? 知ってるよ。 依存配列に入れた値が変更されるたびに関数が実行されるフックでしょ? これは半分正解ですが、半分間違っています。 useEffect のデフォルトの挙動は「レンダーのたびに毎回実行」です。 依存配列は「変わった時に実行する」というより「変わらなければスキップ」と捉えたほうが良いかもしれません。 useEffect は再レンダー以外の変化を検知できません。 特にミュータブルなオブジェクトが絡む場合は注意 React 公式のドキュメントの解説を見ながら、以上の2つのポイントに絞って、誤解を解いていこうと思います。 宣伝 useMemo, useState についても記事を書きました。よかったらこちらも確認してください。 2023/10/03 追記: ブラッシュアップしました ブラッシュアップしたので、そちらの記事も
By switching from CRA to Next.js, we reduced our initial page load times by 70% and unlocked a new level of developer experience. Causal is a multidimensional spreadsheet that’s capable of handling everything from basic arithmetic all the way up to billion-calculation financial models. The Causal frontend was built with Create React App (CRA) in 2019, and it served us well - it required minimal in
Random musings on React, Redux, and more, by Redux maintainer Mark "acemarke" Erikson This is a post in the Blogged Answers series. Details on how React rendering behaves, and how use of Context and React-Redux affect rendering I've seen a lot of ongoing confusion over when, why, and how React will re-render components, and how use of Context and React-Redux will affect the timing and scope of tho
Dear React.js, We've been together for almost 10 years. We've come a long way. But things are getting out of hand. We need to talk. It's embarrassing, I know. Nobody wants to have that conversation. So instead, I'll say it in songs. You Were The OneI'm not a first-time JS lover. I've had long adventures with jQuery, Backbone.js, and Angular.js before you. I knew what I could expect from a relation
Creating a new React application is not a simple task. Not just because you’ll have to work hard, but mainly because you have some key decisions to make that will affect your ability to scale, collaborate, and make this app work with the tools and needs you use today — and in the future. The decision on how to create a new React application need to be made in light of your end goal — are you build
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く