REACT and TypeScript

Little how-tos, examples, and tips for using react with type-script. These are my notes from the Udemy course using React and Typescript.

Absolute Paths in NestJS

In order to import application components via a relative path in a Node.js application, it might be better to use absolute paths. With absolute paths, you can move your components wherever you want, and you can see exactly what an import is all about on the import path. To activate this in a TypeScript project, like all NestJS-Application, you need to add a “path” configuration to the tsconfig.json like this:…

Read more

The minimal react application (with TypeScript)

To create a new React application, enter the following command: npx create-react-app react-app –template typescript A minimal react application contains an index.html page with an element marked with id=”root” and an index.tsx (TypeScript with jsx included) with the following content: // Importing ReactDOM. Needed to render the page.import ReactDOM from “react-dom”;// Build a minimal React-Function Component as a Function// that returns some Contentconst App = () => { return <div>…

Read more
Nach oben scrollen