-
Run
npx create-react-app --template=typescript name_of_project_here
-
Go into the src folder and delete the following files
- App.css
- App.test.tsx
- index.css
- logo.svg
- react-app-env.d.ts
- setupTest.ts
- serviceWorker.ts
-
Go into index.tsx and remove the following
import "./index.css"; import "./index.css"; import * as serviceWorker from "./serviceWorker";
// If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.unregister();
-
Got into App.tsx and remove the following
import logo from "./logo.svg"; import "./App.css";
<header className="App-header"> <img src="{logo}" className="App-logo" alt="logo" /> <p>Edit <code>src/App.tsx</code> and save to reload.</p> <a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer" > Learn React </a> </header>
-
Create a components folder
-
Make the following files
- Todo.tsx
- TodoList.tsx
- AddTodoForm.tsx
-
Initialize files above with format below
import React from "react"; interface INameOfComponentProps {} export const NameOfComponent = (props: INameOfComponentProps) => { return <div className="name-of-component"></div>; };
-
Create a todos.ts file in the src folder
-
Insert the following code into the file
export interface Todo { id: number; title: string; isCompleted: boolean; }
-
Create a list of todos
export let todos: Todo[] = [ { id: 1, title: "todo 1", isCompleted: true, }, { id: 2, title: "todo 2", isCompleted: true, }, { id: 3, title: "todo 3", isCompleted: false, }, { id: 4, title: "todo 4", isCompleted: true, }, { id: 5, title: "todo 5", isCompleted: false, }, ];
-
Add TodoList to App.tsx and pass it the todos
-
Map through the todos
-
Add title and checkbox to Todo
-
Center list
-
Add delete button
-
Use state for the Todo list
-
Add conditional styling for todo title
-
implement functionality
epics-react-tut's Introduction
epics-react-tut's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.