Got the error "value must be string"
See original GitHub issueI dit this function:
function Wysiwyg() {
const editor = React.useRef(null)
const [content, setContent] = React.useState('')
const config = {
readonly: false, // all options from https://xdsoft.net/jodit/doc/
}
return (
<JoditEditor
ref={editor}
value={content}
config={config}
// eslint-disable-next-line
tabIndex={1} // tabIndex of textarea
onBlur={(newContent) => setContent(newContent)}
onChange={() => {}}
/>
)
}
But when I click on the are I get an error message “value must be string”. I use React 16.13
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:10
Top Results From Across the Web
Validation error - Value must be a string - Yii Framework Forum
So I am trying to typecast the necessary value through validation. The way it is written now does not change anything.
Read more >Value must be of type String: " + parameterName + " - Opster
A detailed guide on how to resolve errors related to "Value must be of type String: " + parameterName + ""
Read more >Whi i get the error "token must be a string"? - Stack Overflow
I'm trying to use useEffect to set the behaviour for my room and at first, i wanna use the token and roomName to...
Read more >Date/Time Error: (Operation value must be a string...
I have created a rule to compare a dropdown field and assign a date {{now.plusDays(14)}} to a Date Picker field and am getting...
Read more >Typeerror: string indices must be integers – How to Fix in Python
We get the "TypeError: string indices must be integers" error when we try to access a character using its string value rather the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OnBlur currently return a FocusEvent and not a string value. Which is why the error occurs. I managed to get the value by creating a OnBlur handler like this:
const onBlur = (event: any) => { const editorValue = event.target.innerHTML; setContent(editorValue); };
Then props:
OnBlur={onBlur}
Workaround, but either the docs/types should be updated or make the return value a string value again.
Hi guys! I dealt with this problem like this:
onBlur={newContent => setContent(newContent.target.innerHTML)}
And everything works perfectly 👏🏻