Other ways to add react to your project:
Importing packages directly
Using the npm prefix in an import statement imports the package directly from npm.*
main.ts
import { useState } from 'npm:react'
Using the Deno CLI
Use deno add
or deno install
to add packages to your project.*
$ deno install npm:react
Using an import map
Use an import map to map the npm package to a local import.*
deno.json
...
{
"imports": {
"react": "npm:react"
...
}
main.ts
import { useState } from 'react';
Manage dependency versions with ease
Did you know Deno has a built-in dependency version manager?
Whether your packages are from npm or JSR, Deno can help you manage them and keep the installed versions up-to-date.
Use deno outdated
to track and manage dependecy versions in your project.
$ deno outdated
┌───────────┬─────────┬────────┬────────┐
│ Package │ Current │ Update │ Latest │
├───────────┼─────────┼────────┼────────┤
│ npm:react │ 18.2.0 │ 18.2.0 │ 19.1.0 │
├───────────┼─────────┼────────┼────────┤
│ npm:vite │ 4.5.10 │ 4.5.11 │ 6.2.4 │
└───────────┴─────────┴────────┴────────┘