I have tried the following, expecting to have some kind of validation warning msg on the Chrome console, but nothing happens (console all crear) when not setting the "title" variable on the main.jsx FirstApp component
main.jsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import {FirstApp} from './FirstApp';
ReactDOM.createRoot( document.getElementById('root') ).render(
<React.StrictMode>
<FirstApp/>
</React.StrictMode>
);
FirstApp.jsx
import PropTypes from 'prop-types';
export const FirstApp = ({title}) => {
return (
<>
<h1>{title}</h1>
<h2>Hello World</h2>
</>
)
}
FirstApp.propTypes = {
title: PropTypes.string.isRequired
}
I have checked the browser settings, reset to defaults with no result. The component is working as I am able to see Hello World. I'm using Vite and running: npm run dev. Here below my package.json dependencies:
"prop-types": "^15.8.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
I have tried the following, expecting to have some kind of validation warning msg on the Chrome console, but nothing happens (console all crear) when not setting the "title" variable on the main.jsx FirstApp component
main.jsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import {FirstApp} from './FirstApp';
ReactDOM.createRoot( document.getElementById('root') ).render(
<React.StrictMode>
<FirstApp/>
</React.StrictMode>
);
FirstApp.jsx
import PropTypes from 'prop-types';
export const FirstApp = ({title}) => {
return (
<>
<h1>{title}</h1>
<h2>Hello World</h2>
</>
)
}
FirstApp.propTypes = {
title: PropTypes.string.isRequired
}
I have checked the browser settings, reset to defaults with no result. The component is working as I am able to see Hello World. I'm using Vite and running: npm run dev. Here below my package.json dependencies:
"prop-types": "^15.8.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
Share
Improve this question
edited Feb 23 at 11:12
Antonio Retamosa
asked Feb 23 at 10:53
Antonio RetamosaAntonio Retamosa
11 bronze badge
1 Answer
Reset to default -1I jave just found prop-types are no longer validated in React 19.