Join Slack
How to convert this to the latest kotlin-react? <https://codesandbox.io/s/cold-pine-eyr62?file=/src/...
# react
r
Robert Jaros
04/14/2022, 11:08 AM
How to convert this to the latest kotlin-react?
https://codesandbox.io/s/cold-pine-eyr62?file=/src/index.js
t
turansky
04/14/2022, 4:54 PM
Is it about
ref
?
r
Robert Jaros
04/14/2022, 4:54 PM
Yes
Robert Jaros
04/14/2022, 4:58 PM
I found something about
RefCallback
and it does seem to work here:
https://github.com/rjaros/kvision/blob/master/kvision-modules/kvision-react/src/test/kotlin/test/io/kvision/react/ReactSpec.kt#L41-L54
But I'm not sure this is correct and I get a warning from react in logs about wrong use of hooks.
t
turansky
04/14/2022, 5:00 PM
If you want in place call - use
RefCallback
factory (not hook)
r
Robert Jaros
04/14/2022, 5:07 PM
Tests are passing, the warning is gone. Thank you 🙂
t
turansky
04/14/2022, 5:07 PM
Hook - for memoization
turansky
04/14/2022, 5:08 PM
If memoization ist’s required - you can use factory method
49
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by