Giter Site home page Giter Site logo

tutorial-react-redux's Introduction

React Redux Basic Tutorial

Components

  • TodoApp container component rendering below:

    • AddTodo user form to enter/add item

    • TodoList renders list of todos

    • Todo renders single item

    • VisibilityFilters filter links: accepts activeFilter prop; dispatches setFilter actions

  • constants enum of filters

  • index renders app to the DOM

  • Redux https://redux.js.org/basics/basic-tutorial

    • Actions

    • Reducers

    • Store the state

    • Data Flow

    • Other

      • Action Types actionTypes.js to hold reusable constants of action types

      • Selectors gets data from store

Notes

  • React hypes the "virtual dom" as the reason react is so fast

  • Components "look like" HTML templates (actually JSX)

    • components may contain state

    • may contain JS for functionality

    • must have render() method, typically return ($HTML_JSX) ⇐ best to have single root element

    • JSX uses attribute className in place of class because it is reserved keyword in JS

    • ReactDOM.render(<MyApp />, document.getElementById('app'));

    • JSX render js in string: <p>{ Math.random() * 10 }</p> or <p>My name is { this.state.name }</p>

  • CDN of react as core links: https://reactjs.org/docs/cdn-links.html

    • option for dev vs. production (minified) links

    • browser render babel:

      • <script crossorigin src="https://unpkg.com/babel-standalone@6/bable.min.js></script>

      • <script type="text/babel">…​class MyApp extends React.component {…​} …​</script>

  • VS Code Helper plugins

    • ES7 React/Redux/GraphQL snippets

    • Sublime Babel syntax highlighting of JSX

    • LiveServer to open code in browser

  • Chrome Extension: React Developer Tools ads "React" section in deve tools

  • src/redux/reducers/todos.js heavily leverages ES6 deconstructor syntax …​XXX

  • wrap <TodoApp /> with <Provider /> API provided by React Redux

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.