Publish a React component with TypeScript

Share this video with your friends

Send Tweet

In this lesson we look at how to create a React Component package using TypeScript.

Creating a React Package is very similar to creating any other TypeScript Node package and we demonstrate that here.

Marrion Luaka
Marrion Luaka
~ 7 years ago

Awesome course!

~ 7 years ago

Yes! We want more :D

Annar Ankin
Annar Ankin
~ 7 years ago

Thanks, this was interesting! Helpful stuff.

Brendan Whiting
Brendan Whiting
~ 6 years ago

I don’t understand exactly what a peer dependency is. And I got this error where it says “Cannot find module 'react’” from fancy/lib when trying to use from the other project.

mathias gheno
mathias gheno
~ 6 years ago

I got some error in the build. To solve the problem I added the lib configuration in the tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["es5", "es6", "dom"],
    "jsx": "react",
    "sourceMap": true,
    "outDir": "lib",
    "declaration": true
  },
  "include": [
    "src"
  ]
}
~ 4 years ago

The tsconfig is wrong. Please use proper tsconfig settings { "compilerOptions": { "sourceMap": true, "module": "commonjs", "lib": [ "dom", "es6" ], "target": "ES5", "jsx": "react", "declaration": true, "esModuleInterop": true, "outDir": "lib", "typeRoots": [ "node_modules/@types" ] }, "include": [ "src" ] }