Ask coding questions

← Back to all posts
TypeScript in a Node.js project
h
PabloSzx (2)

Hi, I just installed TypeScript in a Next.js project and when I try to import from react it just says, "Cannot find module 'react'."

Commentshotnewtop
PDanielY (966)

You don't need to import react in a next project

PabloSzx (2)

@PDanielY The fact that I'm not using any of the library doesn't mean that it will work, I will add a useState that changes an input to show that the error persists

PabloSzx (2)

@PDanielY I just added a simple useState + input, that does need to import React, and even the JSX is showing the error "Cannot Find React"

[deleted]

what is the goal of this repl?

PabloSzx (2)

@Zuhdi28 to show TypeScript + Next.js?

PabloSzx (2)

The code actually runs ok, and it type-checks, but the editor itself shows it like an error