목록분류 전체보기 (373)
Silver Library (Archived)
Suppose you installed react with npx create-react-app and install typescript on it as well. And you need a quick solution of it. Here is how I did. npm install --save typescript @types/node @types/react @types/react-dom @types/jest Add tsconfig.json with tsc --init Modify App.js and index.js to tsx. You will see errors. This means you need to define types for its error to be removed. Index.tsx w..
Let's see how it would look like with class and functional component each. // class based component class AnimeComponent extends React.Component { constructor(props) { super(props)' this.state = { count: 0 }; this.handleClick = this.handleClick.bind(this); } handleClick() { this.setState(state => ({ count: state.count + 1 })); } render() { return ( Clicked {this.state.count} times. ); } } // fun..
Note: this post is a scrapped version of explained pagination. See the link below to read the original text. Basic concept: we need as props to our Pagination component: totalCount: represents the total count of data available from the source. currentPage: represents the current active page. We'll use a 1-based index instead of a traditional 0-based index for our currentPage value. pageSize: rep..
Looks like I made a wrong assumption. Loop and iteration are not the same but sharing some common point. What are they? A for loop is a type of loop in programming that allows you to iterate over a sequence of elements, such as a list or an array. It typically includes a loop variable, which is used to keep track of the current element in the sequence, and a loop body, which contains the code th..