I am using a ref created using createRef to store a string value in a class component. However, whenever I try to change the value of current, I get the error that current is ready only. I am using typescript:
class MyClassComponent extends React.Component {
myRef = React.createRef<string>();
someFunction = () => {
this.myRef.current = 'value'; //error here: current is ready only.
};
}