Reputation: 1
I have that React Component and I need to rewrite it to recompose. I don't know how to do it correctly. Can you help me?
import React, { Component } from "react";
import autosize from "autosize";
class Textarea extends Component {
componentDidMount() {
this.textarea.focus();
autosize(this.textarea);
}
render() {
return (
<textarea
ref={c => (this.textarea = c)}
placeholder={'Tell us your story...'}
/>
);
}
}
export default Textarea
Upvotes: 0
Views: 92
Reputation: 437
In my opinion its not worth using recompose to refactor components that need access to refs. You need to access the this context in the component and recompose only makes this more convoluted. (you can try withLifecycle but I think youre going to lose the context you need)
You can use withProps to provide the placeholder text but thats the only use for recompose I'd suggest.
Upvotes: 0