Property does not exist on type 'JSX.IntrinsicElements'

avatar
Borislav Hadzhiev

Last updated: Feb 29, 2024
2 min

banner

# Property does not exist on type 'JSX.IntrinsicElements'

The error "Property does not exist on type 'JSX.IntrinsicElements'" occurs when a component's name starts with a lowercase letter.

To solve the error, make sure to always start component names with a capital letter, install the types for React and restart your dev server.

property does not exist on type jsx intrinsicelements

shell
Warning: <myComponent /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.

Here is an example of how the error occurs.

App.tsx
// ๐Ÿ‘‡๏ธ name starts with a lowercase letter function myComponent() { return <h1>Hello world</h1>; } function App() { return ( <div> {/* โ›”๏ธ Property does not exist on type 'JSX.IntrinsicElements'. */} <myComponent /> </div> ); } export default App;

The issue in the code sample above is that myComponent starts with a lowercase letter.

# All component names must start with an uppercase letter

To solve the error, make sure that all component names start with an uppercase letter.

App.tsx
function MyComponent() { return <h1>Hello world</h1>; } function App() { return ( <div> <MyComponent /> </div> ); } export default App;

all component names must start with uppercase letter

The code for this article is available on GitHub

React uses this naming convention to differentiate between built-in elements like p, div, span and custom components we define.

If the error is not resolved, restart your IDE and development server.

# Install the typings for react and react-dom

If that didn't help, make sure you have the typings for react installed. Open your terminal in the root directory of your project (where your package.json file is) and run the following command.

shell
# ๐Ÿ‘‡๏ธ with NPM npm install --save-dev @types/react @types/react-dom # ---------------------------------------------- # ๐Ÿ‘‡๏ธ with YARN yarn add @types/react @types/react-dom --dev

install typings for react and react dom

The code for this article is available on GitHub

# Delete your node_modules and reinstall your dependencies

If the error is not resolved, try to delete your node_modules and package-lock.json (not package.json) files, re-run npm install and restart your IDE.

If you are on macOS or Linux, issue the following commands in bash or zsh.

shell
# for macOS and Linux rm -rf node_modules rm -f package-lock.json rm -f yarn.lock # ๐Ÿ‘‡๏ธ clean npm cache npm cache clean --force # ๐Ÿ‘‡๏ธ install packages npm install

If you are on Windows, issue the following commands in CMD.

cmd
# for Windows rd /s /q "node_modules" del package-lock.json del -f yarn.lock # ๐Ÿ‘‡๏ธ clean npm cache npm cache clean --force # ๐Ÿ‘‡๏ธ install packages npm install
The code for this article is available on GitHub

Make sure to restart your IDE and dev server if the error persists. VSCode often glitches and a reboot solves things sometimes.

If you get the error JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists, click on the link and follow the instructions.

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.

Copyright ยฉ 2024 Borislav Hadzhiev