Coder Social home page Coder Social logo

kazuto09 / ryugi_classtofc Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 2.47 MB

React の流儀のサンプルコードをクラスを使用せずに関数のみで作成。stateの管理をHOOK(usestate)で行ってみました。

HTML 14.96% JavaScript 84.82% Shell 0.22%

ryugi_classtofc's Introduction

ryugi_classtofc

題:Reactの流儀のサンプルコードを分割し、usestateを使用して関数のみで作成してみた。

【ざっくりと解説】

※前提条件としてReactの流儀のソースコードを読んでいてstate管理の概念を多少なりとも理解していること

<Reactの流儀> https://ja.reactjs.org/docs/thinking-in-react.html

---state管理ついて----

template配下(アトミックデザインで言うところのtemplateの概念とは少し異なる。)のFilterableProductTable.jsxにstateを持たせた。子要素にはそのstate変更用の関数をpropsとして渡している。 organisms配下のSearchBar.jsxがOnchangeの際に画面から受け取ったvalue要素、checked要素を親(FilterableProductTable.jsx)からpropsで渡されたstate関数を使用(経由)して親のpropsを変更している。それによってorganisms配下のProductTable.jsxに渡るpropsが変わるので、商品がフィルタされる仕組み。 ※移植に力を入れたので細かい動作の認識が間違っていたらすみません。

---propsの流れについて----

Pasges配下のProductPagesjsxの同階層にあるPRODUCTSjsxのデータを子要素へ渡している。当データの流れを追うことでpropsを子に流す感覚の理解が深まると思う。

以上、とにかく早く共有することを目的にした解説だったので駄文ですみません。随時追記修正を加える予定です。

ryugi_classtofc's People

Contributors

kazuto09 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.