Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
How to merge react props with external JSON

Code Sandbox: https://codesandbox.io/s/frosty-yalow-19k5u7?file=/src/Item.tsx

Problem

I have a tiptap editor (ProseMirror under the hood) component that accepts a content value as props.

This value is first merged with a default JSON object (which is a valid ProseMirror state), then I put this merged object in a Ref object.

Finally the ref object is the initialization state of the editor.

However, When I loop through the data and create multiple editors, they all have the same value (the last one in the data object).

First try:

DEFAULT.content[0].content[0].text = content;

I also tried

const defaultContent = { ...DEFAULT };
defaultContent.content[0].content[0].text = content;

However, if I pass props.content to useRef directly, it works. What am I doing wrong here?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!