I am using the stdweb library to call a Rust function from JavaScript:
#[js_export]
fn handleClick(e: Value) {
js!{ alert("Hello!"); }
}
It works, but I have to add the namespace Module.exports. to call it:
React.createElement("p",{onClick: e => Module.exports.handleClick(e) }, ... }
How can I hide this namespace or make it smaller?
function Hello(props) { return <h1>Hello!</h1>;}is a component that can be used asvar elem = <Hello/>;. When I create the component in Rust and use it in the same file I need to add the namespace. From another file, I can doimport { Hello } from './comp.js';and use Hello without a namespace. I want to use Hello without a namespace in both cases.