Git Product home page Git Product logo

react-typescript-samples's Introduction

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:

  • Hooks: set of samples migrated to hooks (right now 15 samples migrated), if you are new to React, or you are going to start working on a new project, We recommend you going through these examples.

  • Old_class_components_samples: The old samples, just in case you need to work with older react versions or you need to maintain legacy code.

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:

  • Bundling based on webpack.
  • React + Typescript based.
  • Simple navigation using react-router.
  • Managing async calls and updates.
  • Using Redux library (not available yet on hooks version, coming soon).
  • Handling async calls via Redux-Thunk + Redux Saga (not available yet on hooks version, coming soon)
  • Adding unit testing support (not available yet on hooks version, coming soon).
  • Implementing Lazy Loading (not available yet on hooks version, coming soon).
  • ...

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

Bundling + npm start based on webpack.

Display the text 'Hello React'.

Hello world, simples react render sample.

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

Introduce a basic React concept, handling properties.

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

Introduce a basic React concept, handling State using hooks.

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

Using callbacks.

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

Refactor the job done.

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

Enable/disable components.

Simple color picker demo (show how properties work).

ColorPicker refactor.

Implementation of a single sidebar.

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

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

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

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

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

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:

  • Login: required, must be a string (at least length 3).

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

react-typescript-samples's People

Contributors

brauliodiez avatar nasdan avatar jsagardoy avatar lokeeto avatar antoniogiroz avatar carlostxm avatar ebarriosara avatar esterlaura avatar dailymp avatar josemigallas avatar javierifencamina avatar maxfarseer avatar v-borrego avatar datencia avatar igoralvarez avatar pablonete avatar sermmor avatar foilking avatar arp82 avatar tarosunn avatar stak99 avatar lissetteibnz avatar oguzkaganeren avatar jonchica avatar javierif avatar benrobot avatar adriapl 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.