Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An introduction to React development

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

An introduction to React development

Avatar for Eugene Oskin

Eugene Oskin

January 20, 2018

More Decks by Eugene Oskin

Other Decks in Programming

Transcript

  1. I will not talk about • testing - e2e, unit

    • Deployment • ReactNative • ReactVR • ServerSide Rendering
  2. How to start • CodePen • JSFiddle • etc •

    Create-react-app • StackBlitz • Stafolds / Project templates
  3. Simple React app structure app $ tree . ├── components

    │ ├── App.jsx │ └── Note.jsx ├── index.jsx └── main.css
  4. ToolKit • Browser • VCCode :rocket: • Yarn • ES8

    • Eslint • Flow • Webpack • jest
  5. React Router index.js import React from 'react' import { render

    } from 'react-dom' import { BrowserRouter } from 'react-router-dom' import App from './components/App'; render(( <BrowserRouter> <App /> </BrowserRouter> ), document.getElementById('root'));
  6. React Router inside the App import { Roster, Schedule }

    from './components' const Main = () => ( <main> <Switch> <Route exact path='/' component={Home}/> <Route path='/roster' component={Roster}/> </Switch> </main> ) export default Main
  7. State { todos: [{ text: 'Learn Redux', completed: true },

    { text: 'Learn React', completed: false }], visibilityFilter: 'SHOW_COMPLETED' }
  8. Actions { type: 'ADD_TODO', text: 'Go to swimming pool' }

    { type: 'TOGGLE_TODO', index: 1 } { type: 'SET_VISIBILITY_FILTER', filter: 'SHOW_ALL' }
  9. References • React Router Tutorial • Redux Glossary • EggHead

    courses • Create-react-app • CodePen • JSFiddle