Migrating a kotlin react application with hooks fr...
# javascript
g
Migrating a kotlin react application with hooks from kotlin 1.3.72 to kotlin 1.4, I’m facing a strange issue. React throws this exception: “Rendered fewer hooks than expected. This may be caused by an accidental early return statement.” I can’t find the cause of it because debugging is quite tricky. Does anybody has faced this issue or have some ideas on how to resolve it?
m
I also had the same issue when I migrated to 1.4.0. If I remember correctly, I fixed it by removing the
npm
dependencies to React in my
build.gradle
file. These are the only dependencies related to React I have now:
Copy code
implementation("org.jetbrains:kotlin-react:16.13.1-pre.111-kotlin-1.4.0")
implementation("org.jetbrains:kotlin-react-dom:16.13.1-pre.111-kotlin-1.4.0")
implementation("org.jetbrains:kotlin-styled:1.0.0-pre.111-kotlin-1.4.0")
🙏 2
👍 3
g
Thank you so much. I spend too much time on this. I already tried to remove npm react dependency but didn’t remove all npm dependencies. I also had to remove
Copy code
implementation(npm("styled-components", "5.1.1"))
to make it works.
👍 2