Chapter 9. Frontend and Backend Frameworks
While you could build every part of your application yourself from the ground up—the networking and database layers on the server, a user interface framework and state management solution on the frontend—you probably shouldn’t. It’s hard to get the details right, and luckily for us, lots of these hard problems on the frontend and backend have already been solved by other engineers. By taking advantage of existing tools, libraries, and frameworks to build things both on the frontend and the backend, we can iterate quickly and on stable ground when building our own applications.
In this chapter, we’ll go through some of the most popular tools and frameworks that solve common problems on both the client and the server. We’ll talk about what you might use each framework for, and how to safely integrate it into your TypeScript application.
Frontend Frameworks
TypeScript is a natural fit for the world of frontend applications. With its rich support for JSX and its ability to safely model mutability, TypeScript lends structure and safety to your application and makes it easier to write correct, maintainable code in the fast-paced environment that is frontend development.
Of course, all of the built-in DOM APIs are typesafe. To use them from TypeScript, just include their type declarations in your project’s tsconfig.json:
{
"compilerOptions"
:
{
"lib"
:
[
"dom"
,
"es2015"
]
}
}
That will tell TypeScript to include lib.dom.d.ts—its built-in browser ...
Get Programming TypeScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.