Comments (7)
For those who is facing same issue, here the solution:-
Add following to your package.json
"resolutions": {
"@types/react": "17.0.2",
"@types/react-dom": "17.0.2"
},
After then run yarn
command. Close and restart the server.
from react-helmet-async.
Hi, you might have an outdated @types/react
in your yarn.lock or npm.lock. I had the same issue, and in my lock file had both v17 and v18 types. I just deleted the entry in the lockfile for v17, and re-ran yarn
(I think the same should apply for npm).
from react-helmet-async.
I have also encountered the same issue as @chebread . @kamiyo I'm using react v^17.0.2
and @types/react ^17.0.33
, yet still I can't fix it.
from react-helmet-async.
@meassinal Did you make sure there were no other versions of @types/react
in your lock file? Even though my package.json
had the right typings, either because of another library or whatever reason, it kept both versions around in the yarn.lock
. Once I deleted them manually from the lockfile (I think I just used a basic search for @types/react
and checked the version referenced in the block) I re-ran yarn
. You should see yarn deleting the old unused version.
Of course, it could be another issue that's not related to this...
from react-helmet-async.
@kamiyo Thank you for your reply. I decided to use https://github.com/justinmahar/react-super-seo instead as it doesn't have any conflict in my project. Let's see in the future if I happen to come back to react-helmet-async
.
from react-helmet-async.
Hey, any update on this?
index.tsx
import ReactDOM from 'react-dom';
import { HelmetProvider } from 'react-helmet-async';
import { BrowserRouter } from 'react-router-dom';
import 'nprogress/nprogress.css';
import App from 'src/App';
import * as serviceWorker from 'src/serviceWorker';
ReactDOM.render(
<HelmetProvider>
<BrowserRouter>
<App />
</BrowserRouter>
</HelmetProvider>,
document.getElementById('root')
);
serviceWorker.unregister();
TS2786: 'HelmetProvider' cannot be used as a JSX component.
Its instance type 'HelmetProvider' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'React.ReactNode' is not assignable to type 'import("C:/Users/DELL/Documents/GitHub/bookeezz_admin/.yarn/cache/@types-react-npm-18.2.21-c50bc2f785-ffed203bfe.zip/node_modules/@types/react/ts5.0/index").ReactNode'.
Type '{}' is not assignable to type 'ReactNode'.ts(2786)
8 |
9 | ReactDOM.render(
> 10 | <HelmetProvider>
| ^^^^^^^^^^^^^^
11 | <BrowserRouter>
12 | <App />
13 | </BrowserRouter>
I am using following;-
@types/react 17.0.40
@types/react-dom 17.0.13
react-helmet-async 1.3.0
typescript 4.7.3
Any solutions so far?
I don't know if it is raised by using yarn 3 or not? can it be?
from react-helmet-async.
TS types will be more stable on next release, which is imminent #197
from react-helmet-async.
Related Issues (20)
- Is this project in maintainence mode? HOT 1
- Favicon not updating on Google Chrome but working fine on Mozilla Firefox HOT 3
- preview url not working HOT 1
- Optional Context break in 0.2.0 HOT 2
- No release notes HOT 6
- onload is not working because is getting rendered as string
- [2.0.1] typing issue on HelmetProvider
- `/*#__PURE__*/` annotations don't play well with Vite / Rollup HOT 3
- Vite SSG: The requested module 'react-helmet-async' does not provide an export named 'HelmetProvider' HOT 5
- Support for micro-frontends (container app with hosted apps)
- fix: The url for constants.js in the readMe file
- Module parse failed: unexpected token HOT 5
- using UNSAFE_componentWillMount in strict mode HOT 1
- Meta keywords and description are disabled
- Is there a way to specify a default title? HOT 1
- Is it possible to change meta tags dynamically while page is loading and after that share it to some socials? HOT 2
- Support to preact?
- Add Installation Section to README.md HOT 1
- g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g g'、
- Only some tags are being rendered?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-helmet-async.