question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't call `setValue` on Editor React component

See original GitHub issue

Do you want to request a feature or report a bug?

BUG

What’s the current behavior?

Editor react component instance is missing the setValue method. In plugin event handler, I can’t call editor.setValue as it’s undefined.

What’s the expected behavior?

Editor react component instance has the setValue method. It should be possible to call editor.setValue from plugin event handler.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ianstormtaylorcommented, May 9, 2019

Hey, this is by design because setValue is an internal-type method for setting things up. Event handlers should not be calling editor.setValue and should instead be using operations to achieve this.

2reactions
neutraalicommented, Apr 11, 2019

Slate needs more docs on how to utilize the Editor in an uncontrolled way, without having to deal with handling 1000s of state transitions. I’m looking for something like setValue (and getValue?) as well since it’s mentioned in the docs, but when I try to access it from the Editor ref it’s undefined.

Read more comments on GitHub >

github_iconTop Results From Across the Web

setValue is not defined in react for react hooks - Stack Overflow
your updateAPI function cant find setValue useState hook because they are not in the same scope. import React, {useState} from "react"; ...
Read more >
useForm - setValue - React Hook Form
This function allows you to dynamically set the value of a registered field and have the options to validate and update the form...
Read more >
Updating Objects in State - React Docs
State can hold any kind of JavaScript value, including objects. But you shouldn't change objects that you hold in the React state directly....
Read more >
Using localStorage with React Hooks - LogRocket Blog
This makes this Hook a perfect place to call the setItem method. Open the components/Form1.js file and add the following code above the ......
Read more >
Input Components - React-admin - Marmelab
Input components require a source prop. import { Edit, SimpleForm, ReferenceInput, SelectInput, TextInput, required } from 'react-admin'; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found