Open raphaelweis opened 5 months ago
Thank you for this suggestion.
Please note that a similar refactoring has recently been done to reuse code between handleClick
and useEffect
: https://github.com/Hypertopic/HyperGlosae/blob/8db04da049527506224eb612a611fb1ae94ecce7/frontend/src/components/EditableText.js#L23-L30
In editable text, the functions
handleImageUrl
andhandleBlur
are almost identical, with the main difference being the source of the text to update. These can be combined into a single function allowing it's users to update the text for a passage margin, regardless of the input method.