typescript-library-starter icon indicating copy to clipboard operation
typescript-library-starter copied to clipboard

How to integrate REACT

Open anthhub opened this issue 4 years ago • 1 comments

How to integrate REACT; I want it will be great!

anthhub avatar Mar 09 '20 16:03 anthhub

Hello my friend! Follow steps:

  • git clone https://github.com/alexjoverm/typescript-library-starter.git <YOUR_LIB_REACT>
  • cd <YOUR_LIB_REACT>
  • npm i react @types/react
  • change file main to tsx ./src/lib.tsx
  • write your component, as below:
import React from 'react'

export const Component = () => <div>foo bar</div>
  • rollup.config.ts in line 13, change ts to tsx
  • tsconfig.json
"compilerOptions": {
   // ...
   "jsx": "react",
}

rique-dev avatar Mar 15 '20 15:03 rique-dev