React Hot Loader in Kotlin?


#1

Just looking at getting webpack hot module replacement working with a Kotlin react app using React Hot Loader.

From the React Hot Loader site, with a little setup, the code to then use is as follows:

// App.js
import React from 'react'
import { hot } from 'react-hot-loader'

const App = () => <div>Hello World!</div>

export default hot(module)(App)

I can use

@JsModule("react-hot-loader")
private external val hot: dynamic

to get the hot function… but not sure how to get the module value. I assume it is the current node js module. How would I get this “module” var in Kotlin? Not exactly sure how it will go after that, but the “module” is the current stumbling block :slight_smile:

Thanks for any help
C


#2

Sorry, found a way to solve this, I could remove the topic completley, but thought I would leave it for anyone else to google… also, maybe there is a better way of doing it?

The problem was one of the ways I was trying to get the module was by

val module = js("module")

but I was doing this inside a function and that did not work, doing it above the function actually worked and allowed me to use the module var in the function.