Learn React with TypeScript 3

所需积分/C币:15 2018-12-19 12:20:41 6.37MB PDF
收藏 收藏
举报

Book Description React today is one of the most preferred choices for frontend development. Using React with TypeScript enhances development experience and offers a powerful combination to develop high performing web apps. In this book, you’ll learn how to create well structured and reusable react c
Learn React with TypeScript 3 Copyright o 2018 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information Commissioning Editor: Amarabha banerjee Acquisition Editor: Devanshi dosh Content Development Editor: Francis Carneiro Technical Editor: Surabhi Kulkarni opy Editor: Safis Editing Project Coordinator: Kinjal Bari Proofreader: safis editio g Rekha nair Graphics: Alishon mendo Production Coordinator: Aparna Bhagat First published: November 2018 Production reference: 1281118 Published by Packt Publishing ltd 35 Livery street Birmingham B3 2PB, UK ISBN978-1-78961-025-3 acktpub. com Mapt mapt.lO Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website Why subscribe? Spend less time learning and more time coding with practical ebooks and videos from over 4, 000 industry professionals Improve your learning with Skill Plans built especially for you Get a free ebook or video every month e Mapt is fully searchable Copy and paste, print, and bookmark content Packt. com Did you know that Packt offers eBook versions of every book published, with PDF and epubfilesavailableYoucanupgradetotheebookversionatwww.packt.comandasaprint book customer, you are entitled to a discount on the e Book copy. Get in touch with us at customercare@packtpub com for more details Atwww.packt.comyoucanalsoreadacollectionoffreetechnicalarticlessignupfora range of free newsletters and receive exclusive discounts and offers on packt books and eBookS Contributors About the author Carl rippon has been involved in the software industry for over 20 years, developing a complex line of business applications in various sectors. He has spent the last eight years building single page applications using a wide range of JavaScript technologies, including Angular, React]s, and TypeScript. Carl has written over 100 blog posts on various technologies I'd like to thank Sarah, Ellie-Jayne, and Lily-Rose for all the support they ve given me while writing this book. Thanks to everyone in the Packt editorial team for their hard work and great feedback, especially francis Carneiro and Surabhi Kulkarni. Special thanks also to Devanshi Doshi for reaching out to me with this opportunity About the reviewers Ashok Kumar S has been working in the mobile development domain for about six years In his early days, he was a JavaScript and Node developer. Thanks to his strong web development skills, he has mastered web and mobile development. He is a Google-certified engineer, a speaker at global level conferences(including Droid Con Berlin and MODS), and he also runs a you tube channel called android abcd for android developers. He is a computer science and engineering graduate who is passionate about innovation in technology he contributes to open source heavily with a view to improving his e-karma He has also written books on Wear Os programming and mastering the Firebase toolchain In his spare time, he writes articles and makes videos on programming. Ashok Kumar has also reviewed books on mobile and web development, namely Mastering unit 5, Android Programming for Beginners, and developing Enterprise applications using JavaScript I would especially like to thank my mother for her boundless support in every possible way, not to mention family members Shylaja, Sumitra, Krishna, Vinisha, and my fiance, Geetha Shree Dave has had over 16 years experience as a software engineer. After working for a number of creative agencies in london and then as a contract tech lead for a global e-commerce company, he is now tech lead at Seccl Technology, a start-up based in Bath, UK, that is building pioneering digital services for the financial industry, working with a serverless infrastructure in the cloud and providing wonderful experiences through their web applications. He has worked with TypeScript for about five years and has seen it mature a lot over the years. Dave has worked specifically on React applications for over two years, as well on serverless code for the Seccl platform Pogo Kid is Dave's consultancy where he provides support for companies wanting to improve their serverless, React, and Type Script applications. He has also reviewed a couple of book proposals for Manning on Type Script He has had the privilege of bringing leadership to development teams across the world, including many household names. He is a firm believer that when systems have the correct architecture and the team has a good mix of passion and skill, users will have a wonderful experience Daniel Deutsch is working as a web developer in various companies. Although most of his work is structured around client-side development, he is also able to contribute to different problem areas in software development, like the backend devops, or project management Coming from legal fields and also studying law he aims for bringing the 2 areas together and create additional value for both industries. as his personal interest focuses on machine learning, he likes to incorporate more of those disciplines in his day to day work Daniels ultimate goal is to structure a business around motivated people to create something that brings value to humanity and lasts for a long time period Packt is searching for authors like you If you' re interested in becoming an author for Packt, please visit authors. packtpub com and apply today. We have worked with thousands of developers and tech professionals, just like you to help them share their insight with the global tech community you can make a general application, apply for a specific hot topic that we are recruiting an author for or submit your own idea Table of contents Preface Chapter 1: Type Script Basics Technical requirements Understanding the benefits of TypeScript 9 Catching coding errors early 9 Better developer experience and productivity Using future JavaScript features 11 Understanding basic types 12 Primitive types 12 Type annotations 13 Type inference Any 16 Void Never 17 Enumerations 19 Objects 21 Arrays 23 Creating interfaces, types aliases, and classes 25 Interfaces 27 Properties 27 Method signatures 29 Optional properties and parameters 32 Readonly properties 34 Extending interfaces 35 Type aliases 36 Classes 37 Basic classes 37 Implementing interfaces 39 Constructors 39 EXtending classes 41 Abstract classes 42 Access modifiers Property setters and getters 5 Static Structuring code into modules 48 Module formats 49 Exporting 49 Importing 51 Default exports 52 Configuring compilation 52 Table of contents Common options 53 arge 54 outI 54 -module 55 -allowS 55 --watch 55 -nolmplicitany 56 nolmplicitReturns 57 source Map 57 module resolution 58 tsconfig json 58 Specifying files for compilation 59 Type Script linting 60 Installing tslint 60 Configuring rules 61 Built-in rules 63 Excluding files 64 Code formatting 64 Summary 65 Questions 66 Further reading 67 Chapter 2: What is New in Type Script 3 68 Technical requirements 68 Tuples 69 Java script rest and spread syntax 71 Open-ended tuples 73 Tuple function parameters 74 Spread expressions 75 Empty tuples 76 Optional tuple elements 77 The unknown type 80 Type checking with a type predicate 81 Type narrowing with a type assertion 83 Project references 84 Setting up an example 84 Referencing projects 86 Additions to compiler options 87 Cross- project Go to Definition 88 Build mode 90 Default JSX properties 91 Summary 93 Questions 94 Further reading 95 Chapter 3: Getting Started with React and Type Script 96 Table of contents Technical requirements 97 Creating a React and Type Script project 97 Using create-react-app 97 Creating a project manually 101 Creating our folder structure 101 Creating package. json 101 Adding Type Script 102 Creating tsconfig json 102 Adding tsin 103 Adding React with types 103 Creating a root web page 103 Creating a simple React component 104 Adding webpack 105 Project folders and files 106 Creating start and build scripts 107 Creating a class component 108 Creating a basic class component 110 JSX 114 Component props 117 Optional props 118 Default prop values 120 Handling class component events 121 Basic event handlers 121 The this problem 122 Function props 124 Class component states 125 Defining state type 127 Initializing the state 128 Changing state 128 Class component life cycle methods 131 componentDidMount 132 componentWillUnmount 136 getDerived State From Props 136 getSnapshot BeforeUpdate and componentDidUpdate 137 should ComponentUpdate 139 Deprecated life cycle methods 141 Creating a function component 141 Creating a basic function component 141 Stateful function components 144 Function component life cycle hooks 146 Optimizing function component rendering 148 Summary 149 Questions 149 Further reading 150 Chapter 4: Routing with React Router 151 i

...展开详情
试读 127P Learn React with TypeScript 3
立即下载 低至0.43元/次 身份认证VIP会员低至7折
    抢沙发
    一个资源只可评论一次,评论内容不能少于5个字
    关注 私信 TA的资源
    上传资源赚积分,得勋章
    最新推荐
    Learn React with TypeScript 3 15积分/C币 立即下载
    1/127
    Learn React with TypeScript 3第1页
    Learn React with TypeScript 3第2页
    Learn React with TypeScript 3第3页
    Learn React with TypeScript 3第4页
    Learn React with TypeScript 3第5页
    Learn React with TypeScript 3第6页
    Learn React with TypeScript 3第7页
    Learn React with TypeScript 3第8页
    Learn React with TypeScript 3第9页
    Learn React with TypeScript 3第10页
    Learn React with TypeScript 3第11页
    Learn React with TypeScript 3第12页
    Learn React with TypeScript 3第13页
    Learn React with TypeScript 3第14页
    Learn React with TypeScript 3第15页
    Learn React with TypeScript 3第16页
    Learn React with TypeScript 3第17页
    Learn React with TypeScript 3第18页
    Learn React with TypeScript 3第19页
    Learn React with TypeScript 3第20页

    试读已结束,剩余107页未读...

    15积分/C币 立即下载 >