You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uncaught Error: Objects are not valid as a React child #74
After upgrading my Gatsby project dependencies, the editor won't render any text (get Uncaught Error: Objects are not valid as a React child). Everything was working great before. The only thing that doesn't cause a crash is an empty string as the value. As son as I set the value to something as simple as 'test' it crashes.
Expected behaviour
Uncaught Error: Objects are not valid as a React child (found: object with keys {type, value}). If you meant to render a collection of children, use an array instead. in pre (created by Editor) in div (created by Editor) in Editor (at test.tsx:18) in div (at test.tsx:17) in Test (created by HotExportedTest)
Code sample
import React, { useState } from 'react';
import Editor from 'react-simple-code-editor';
// @ts-ignore
import { highlight, languages } from 'prismjs/components/prism-core';
Hi I just got hit by this error and found a way to fix it. The problem seam to be related to prismjs. prismjs apparently for some reasons decided it wanted to f*** ** every projects by no longer generating any HTML code but instead returning a crappy non-sense list of objects.
In order to fix it just locate the line that mentions prismjs in your package.json and replace it with:
"prismjs": "1.20.0",
Notice the remove '^' character.
I have tested this fix on both yarn and npm and it worked on both.
Hi I just got hit by this error and found a way to fix it. The problem seam to be related to prismjs. prismjs apparently for some reasons decided it wanted to f*** ** every projects by no longer generating any HTML code but instead returning a crappy non-sense list of objects.
In order to fix it just locate the line that mentions prismjs in your package.json and replace it with:
"prismjs": "1.20.0",
Notice the remove '^' character.
I have tested this fix on both yarn and npm and it worked on both.
Nope, not working for me , even after making the above changes .
Activity
Yuri6037 commentedon Dec 16, 2020
Hi I just got hit by this error and found a way to fix it. The problem seam to be related to prismjs. prismjs apparently for some reasons decided it wanted to f*** ** every projects by no longer generating any HTML code but instead returning a crappy non-sense list of objects.
In order to fix it just locate the line that mentions prismjs in your package.json and replace it with:
Notice the remove '^' character.
I have tested this fix on both yarn and npm and it worked on both.
saswat3115 commentedon May 12, 2021
after doing above step I am getting below error
×
ReferenceError: Prism is not defined
bhavaniravi commentedon Jun 20, 2021
@saswat3115 you might want to reinstall the npm package with the correct version after changing
package.jsonThank you @Yuri6037, I was stuck with this for hours
gmarathiarcadix commentedon Mar 20, 2023
Nope, not working for me , even after making the above changes .
bhavaniravi commentedon Mar 20, 2023
@gmarathiarcadix you need to do an
npm uninstall prismjsand then reinstall usingnpm installgmarathiarcadix commentedon Mar 20, 2023
did the same thing
uninstalled prismjs
added --> "prismjs": "1.20.0", this line in the pacakge.json
and then issued this cmd -> npm install
i'm using --> "react": "^18.1.0", ( hoope that is fine )