Git Product home page Git Product logo

react-unidirectional-data-lab's Introduction

React Unidirectional Data Lab

Objectives

  1. Coordinate components, actions, and stores to create a unidirectional data flow
  2. Practice modularizing React applications

Overview

In this lab we're going to practice modularizing component architectures by building a note taking application.

This is what it's going to look like:

Screenshot

Components

Screenshot Components

Our application consists of a couple of components that we're going to implement as part of this lab. As usual, the tests will guide us while building them out.

<App />

The primary container of our application is the <App /> component. <App /> adds a listener to the fileStore store when being mounted.

The <App /> component has two child components: <Sidebar /> and <FileView />.

<Sidebar />

<Sidebar /> contains a list of all available notes.

It doesn't subscribe to the store directly, but instead receives the files prop from the <App /> component. <Sidebar /> is stateless. It renders a list of <SidebarItem /> components.

<SidebarItem />

A <SidebarItem /> represents a single note entry in the sidebar. If the note is currently selected, it should have a light background (don't worry about the styling, the CSS is taken care of).

<FileView />

On the right hand side of the app, we can see the so-called "FileView". The <FileView /> component renders a single file.

Our users can edit the file by entering text into the <textarea />.

<Toolbar />

On the top, we can see a toolbar. The <Toolbar /> component contains two buttons. When a user click on the "Add note" button, a new file is added to the end of the fileStore. When a user clicks the "Remove note" button, the currently selected file should be deleted from the fileStore.

There should always be at least one file in the sidebar. If the user attempts to delete the last remaining note, we simply clear the file instead of deleting the note.

Stores

Our editor uses a single fileStore singleton. fileStore inherits from Store, which implements a generic store.

Resources

react-unidirectional-data-lab's People

Contributors

alexandergugel avatar aturkewi avatar danielseehausen avatar lukeghenco avatar pletcher avatar thomastuts avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

beejluig

react-unidirectional-data-lab's Issues

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.