Closed dartess closed 3 years ago
Hi! Sorry for that late reply.
First, good catch regarding the bug, and thank you for submitting a PR to fix it. That said, I'm interested in your thoughts on replacing the useRef + useMemo combination for messageHistory with useState + useEffect. The latter results in every new message updating your component twice, no?
I definitely understand why the former pattern raised a flag to you, however (I remember feeling apprehensive about creating a ref just to store messages), but since the examples in the README are likely to be used as a starting point by developers using the library, I want to make sure we get it right.
Once we discuss and agree on a pattern, I will be happy to merge:)
Yeah, you're right. I need some time for find better solution.
Hello!
The example in README doesn't work, because at the time of the first render there is one element in the array (
null
). I rewrote the example in a slightly more react style.