- Initialize project using Create React App,
npx create-react-app my-app --template typescript. - Delete useless files and erase all uselsess codes in them. In my case, delete all the files except
App.tsxandindex.tsx. - Create a directory called
models. - Create
atoms.tsfile inmodelsdirectory and define global states. - Install react-router-dom via npm,
npm i react-router-dom. - Install react-beautiful-dnd via npm,
npm i react-beautiful-dnd. - Create a directory called
routes. - Create
Home.tsxfile inroutesdirectory and defineDragDropContextandDroppablefortype={"boards"}. - Create
Router.tsxfile in root directory and define route forHome.tsx. - Create a directory called
components. - Create
Board.tsx,Task.tsx,TaskTrashCan.tsxandAddBoard.tsxincomponentsdirectory. - Define
Boardcomponent asDraggableinBoards.tsxand addDroppablefor tasks inside. - Define
AddBoardandTaskcomponent asDraggableinAddBoard.tsxandTask.tsx. - Define
TaskTrashCancomponent asDroppableinTaskTrashCan.tsx. - Add
TaskTrashCanbelowDragDropContextopening tag. - Add
BoardandAddBoardin theDroppablearea oftype={"boards"}inHome. - Add
Taskin theDroppablearea of default type inBoard. - Place all the parameters which are needed for drag and drop actions.
- Define function
onDragEndinHomeand add logics for listing. - Create
localStorage.tsfile inmodelsdirectory and define functions for saving data in local storage. - Add local storage saving logic in
Home - Add a button in the
Boardand define onClick event for deleting board. Done.
Please dont' care about the coloring things in this stage, just define components and drag&drop actions.
- Design it with design tools or something, in my case Figma.
- Visit Google Fonts and select the fonts you want to use. Copy the
<link>to embed. - Install react-helmet via npm,
npm install --save react-helmet. - Add
Helmetcomponent aboveRoutercomponent and embed the link that we copied in step 2. - Install styled-compents via npm,
npm install --save styled-components. - Create a directory called
styles. - Remove default settings in CSS. You can do this in various ways. In my case, define
createGlobalStyleinApp.tsxand paste the code of this. - Make
styled.d.tsfile instylesfolder and declare module'styled-components'and add interfaceDefaultTheme. - Make
theme.tsfile instylesfolder and define colors in themes usingDefaultThemeyou want to use. In my case, I defineddarkThemeandlightTheme. - Make
global.d.tsfile insrcfolder and declare modules to use image files. - Show off your CSS skills! Make styled components in the files you need. If you have to make a identical styled
components in different files, make
styles.tsxfile instylesfolder, put them there, and import them where you need.
Please don't just copy my design or codes. That doesn't help you at all.
![]()
-
You can deploy your website in various ways. In my case, I deployed by publishing files to
gh-pagesbranch on GitHub. -
Make Repository on GitHub and push all the files.
-
Install gh-pages via npm,
npm install gh-pages --save-dev. -
Go to
package.jsonand add"homepage"right above the last curly brace. Usehttps://user-id-here.github.io/repository-name-here -
}, "homepage": "https://codeisneverodd.github.io/practice-with-react-typescript-for-crypto-dictionary/" }
-
Add
"deploy"and"predeploy"toscriptinpackage.json. -
"scripts": { "deploy": "gh-pages -d build", "predeploy": "npm run build" },
-
Finish deployment by entering
npm run deployin the console.
Don't forget to add
basename={process.env.PUBLIC_URL}in your BrowserRouter









