Hardeep Singh
Jul 23, 2021

--

I was using mentions with the draft.js (like this @yourname) and sending to database to save and fetching it.

On Sending to database ->

```

const contentState = editorState.getCurrentContent();

const currentStateData = convertToRaw(contentState);

const richStringifyValue = JSON.stringify(currentStateData);

// sending richStringifyValue to DB

```

On Fetch and set in editor ->

```

EditorState.createWithContent(convertFromRaw(JSON.parse(post.contentStyled)))

```

But after setting in editor my mentions (@... @... @...) lost the CSS. What should we do ?

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Hardeep Singh
Hardeep Singh

Written by Hardeep Singh

Software Development Engineer 3 | ReactJs | NodeJs | ExpressJs | NextJs | MongoDB | Micro Frontend | Micro Services

No responses yet

Write a response