1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-typescript
Sagi ab82f06c87 Added react and react-dom dependencies (#2518)
* Added react and react-dom dependencies

Added missing `react` and `react-dom` dependencies which are required by next.js

* Moved react & react-dom to dependencies

Moved react & react-dom to dependencies from devDependencies
2017-07-09 15:26:35 +02:00
..
components TypeScript example proposal (#845) 2017-02-09 12:36:58 +01:00
pages TypeScript example proposal (#845) 2017-02-09 12:36:58 +01:00
.gitignore TypeScript example proposal (#845) 2017-02-09 12:36:58 +01:00
package.json Added react and react-dom dependencies (#2518) 2017-07-09 15:26:35 +02:00
README.md Add deploy now button to the top of all example READMEs (#1763) 2017-04-22 14:51:51 +02:00
tsconfig.json TypeScript example proposal (#845) 2017-02-09 12:36:58 +01:00

Deploy to now

TypeScript Next.js example

This is a really simple project that show the usage of Next.js with TypeScript.

How to use it?

npm install  # to install dependencies
npm run dev  # to compile TypeScript files and to run next.js  

Output JS files are aside the related TypeScript ones.

To fix

In tsconfig.json the options jsx="react" compiles JSX syntax into nested React.createElement calls.
This solution doesn't work well with some Next.js features like next/head or next/link.
The workaround is to create JS files that just return the mentioned module and require them from TSX files.
Like

import Link from 'next/link'

export default Link