Navigation

    Monaca & Onsen UI
    • Login
    • Search
    • Tags
    • Users
    • Blog
    • Playground
    1. Home
    2. patrick
    3. Best
    P
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Best posts made by patrick

    • RE: [OnsenUI2/React] React Component: Event handler looses "this" context

      Hi @JesperWe
      If you use classes the functions are not bind. There are a couple of options on what you can do, the first option binding the function to the class in the constructor. This is necessary for classes:

      export class Result extends Component {
        constructor(props) {
          super(props);
          this. handleClick = this. handleClick.bind(this);
        }
      
        handleClick() {
         ons.notification.alert( this.props.result._id );
        }
      
       render() {
           return (  <Col onClick={this.handleClick}>{this.props.result.text}</Col> );
          }
      }
      

      The second option is to use React.createClass, this bind it automatically:

      const Result = React.createClass({
       handleClick: function() {
         ons.notification.alert( this.props.result._id );
       },
       render: function() {
         return (
            <Col 
              onClick={this.handleClick}
            >{this.props.result.text}
            </Col>
         );
       }
      }
      export Result
      
      posted in Onsen UI
      P
      patrick
    • RE: Wondering the performance when combining react.js

      React Native uses internally the native components, while OnsenUI with Monaca uses the Webview and Phonegap and Cordova. I believe for most applications there is no big distinction in performance between an hybrid app or an native app, but the user experience might be different. Its quite a big topic to open here on the Forum and both native apps and hybrid apps have its pro’s and con’s.

      posted in Onsen UI
      P
      patrick
    • RE: React extention's Navigator doesn't work well with react-redux ?

      @sk sry to keep you waiting, your solutions seems to be fine. My blogpost will be only about redux with vanilla js. If you encounter any problems, feel free to report it on github or ask a question in our community.

      posted in Onsen UI
      P
      patrick