When I pass string as value prop I receive a message: Invalid prop value of type string supplied to MDEditor, expected function.
MD Editor default props:
// Setting default values for the props of MDEditor
MDEditor.defaultProps = {
value: () => {},
};
// Typechecking props for the MDEditor
MDEditor.propTypes = {
value: PropTypes.func,
};
I can provide access to a private repo. Let me know your git username and I'll add you to the organization!
What is expected?
SoftEditor to receive a default value
What is actually happening?
An error saying that I should convert string to function
Solution
<SoftEditor value={() => getDescription()} />
I've tried to wrap my return value into func call, The error message disappeared but the editor didn't have any text in the editor!
Version
4.0.2
Reproduction link
https://codesandbox.io/
Operating System
Mac Ventura 3.4
Device
Macbook Air M1 2020
Browser & Version
Version 116.0.5845.140 Chrome
Steps to reproduce
value
of typestring
supplied toMDEditor
, expectedfunction
.MD Editor default props: // Setting default values for the props of MDEditor MDEditor.defaultProps = { value: () => {}, };
// Typechecking props for the MDEditor MDEditor.propTypes = { value: PropTypes.func, };
I can provide access to a private repo. Let me know your git username and I'll add you to the organization!
What is expected?
SoftEditor to receive a default value
What is actually happening?
An error saying that I should convert string to function
Solution
<SoftEditor value={() => getDescription()} /> I've tried to wrap my return value into func call, The error message disappeared but the editor didn't have any text in the editor!
Additional comments