meteor - How to import&use javascript functions in jsx? -


i want use connect() javascript function in app.jsx. i'm using meteor framework.

app.jsx

import react 'react'; /* [i think import codes should here..] */  export default class app extends react.component {   render() {     return (       <div>         <button            onclick={ /* [i want use connect() function here] */ }         > connect </button>       </div>     );   } } 

connect.js

function connect() {   console.log('connected'); } 

thank you.

you can export , import function.

connect.js

export function connect() {   console.log('connected'); } 

app.jsx

import react 'react'; import {connect} '/path/to/connect.js'  export default class app extends react.component {   render() {     return (       <div>         <button            onclick={connect}         > connect </button>       </div>     );   } } 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -