Home

Awesome

React Typescript by sample

🇪🇸 Versión Español

The goal of this project is to provide a set of simple samples, providing and step by step guide to start working with React and TypeScript.

We have incorporated a set of examples based on hooks.

Right now you got two main folders:

If you want to make a deeper dive on React Hooks you can check this repo React Hooks By Example

Other guided repos available (react / redux + typescript):

Examples

The goal of this project is to provide a set of simple samples, providing and step by step guide to start working with React and Typescript. Characteristics:

To get started:

  1. Install NodeJS
  2. Download this repo
  3. Open the command line of your choice and cd to a sample directory within this repo on your machine
  4. npm install - Installs packages
  5. npm start - Builds the project and launch a lite web server (webpack-dev-server).
  6. Navigate to http://localhost:8080/ if your browser doesn't open automatically.

samples

Hooks

00 Boiler plate

Bundling + npm start based on webpack.

01 Hello React

Display the text 'Hello React'.

Hello world, simples react render sample.

02 Properties

Display the text 'Hello {name}' (where name is a prop that contains a given name).

Introduce a basic React concept, handling properties.

03 State

Starting from sample 02, let's the user change the name to be displayed.

Introduce a basic React concept, handling State using hooks.

04 Callback

Starting from sample 03, let the user change the name only when he hits a change button.

Using callbacks.

05 Refactor

Refactor sample 04, cleanup and discussion on where to place the state.

Refactor the job done.

06 Enable

Starting from sample 05, enable / disable the change button when the text is empty or same name as original name,.

Enable/disable components.

07 ColorPicker

Simple color picker demo (show how properties work).

08 ColorPicker Refactor

ColorPicker refactor.

09 Sidebar

Implementation of a single sidebar.

10 Table Mock

Render a table and use a child component to render each row, using mock data.

11 Table Axios

Starting from sample 10, remove mock data, hit a real REST API (Github api), use axios to perform the fetch call.

12 React Router

Starting from sample 03,start using React-Router (SPA navigation).

13 Login Form

Starting from sample 12, implement a basic login page, that will redirect the user to another page whenever the login has completed successfully.

14 Form Validation

Starting from sample 13, add validation support to login form.

15 Context

Starting from sample 14, learn how React 16 context api works.

Old Class folder

00 Boiler plate

Bundling + npm start based on webpack.

01 Hello React

Hello world, simples react render sample.

02 Components

Creating a common header and about page react components.

03 Navigation

Creating a "members" page, adding navigation using react-router.

04 Display data

Create a read only list component (table >> tr >> td), reading list of members from a fake api and dumping it into component state.

05 Presentational Components

Breaking the list component into two: list and row compomenent, member row entity passed via props.

06 Handling asynchronous calls

Members fake api replaced with async call to api github to retrieve list of members of a given organization.

07 Forms

In this sample we will add a link in the members page that will navigate to a "new member page". This new page will display a form where you have to enter the avatar url, login and id of a new member (just supossing we can edit that info).

08 ParamNavigation + Validations

Edit a given member, here we learn how to add params to a navigation link and how to obtain them from a component.

Validation performed so far:

09 Redux

Added Redux support, isolated state into Redux reducers, implement load, save, basic validation cycle. This sample uses the fake api, in following samples we will call async operations and fitting them into Redux architecture.

10 SpinnerAsync

Display a busy indicator while an ajax request is in progress.

To have a global count of promises gong on we are using react-promise-tracker and to display a cool spinner react-spinner

11 Testing reducers

Sample updated using Jest.

12 Testing actions

Sample updated using Jest.

13 Testing components (Containers and Presentationals)

Pending update Jest + Enzyme

14 Replacing Redux Thunk with Redux Saga

Pending update

15 Lazy Loading and React-Router

Pending update

16 Add custom middlewares

Pending update

17 Add support for ReactHotloader and ReduxDev Tools.

Pending update

18 Hooks

Replace class components by stateless components using Hooks.

19 LoginForm

Add a login page using Material-UI.

Contributors

Thank you very much to the contributors for keeping the project updated in all the examples.

About Basefactor + Lemoncode

We are an innovating team of Javascript experts, passionate about turning your ideas into robust products.

Basefactor, consultancy by Lemoncode provides consultancy and coaching services.

Lemoncode provides training services.

For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend