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
Post a Comment