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 ?

--

--

Hardeep Singh
Hardeep Singh

Written by Hardeep Singh

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

No responses yet