Uncaught TypeError: this.setState is not a function - React-bootstrap-datetimepicker

#1

Posted in github but maybe it is better place here to ask:

#2

Since you’re using ES2015 class syntax with React, this is not automatically bound to the method using it. See the No Autobinding section of the React docs for more info. To fix this in your code, one option involves adjusting your constructor to bind this as follows:

export default class ParentComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      date: moment().format('YYYY-MM-DD HH:mm:ss'),
      format: "YYYY-MM-DD HH:mm:ss",
      inputFormat: "YYYY-MM-DD HH:mm:ss",
      mode: "date"
    };
    this.handleChange = this.handleChange.bind(this);
  }
  ...
}
#3

Thanks Hugh.

so how would I grab the updated datetime from server side if there are two instances of ParentComponent for start_date and end_date? Or should React component only be done on client side?

For some reason when trying to import client/components/ParentComponent.jsx into server/entry.jsx , says ParentComponent.jsx cannot be found?

server/entry.jsx:

import '../client/components/ParentComponent.jsx'; <-- Error: Cannot find module '../client/components/ParentComponent.jsx'

or

import ParentComponent from '../client/components/ParentComponent.jsx';<-- Error: Cannot find module '../client/components/ParentComponent.jsx'

But clearly Pycharm auto-completion worked and suggested correct path.

Assuming the above is solved then would like to grab

i.e.

<h1>Start_Time</h1>
<ParentComponent>

<h1>End_Time</h1>
<ParentComponent>

<button>

Such that if button is clicked then grabs the current start_date and end_date and inserts into collection:

server/entry.jxs:

Meteor.methods {
    addTestTicket: function (text) {

       FutureTasks.insert({
            userid: text,            
            start_date:  ParentComponent.handleChange()?
            end_date:   ParentComponent.handleChange()?
    } 
}

So we make instance of React class just like any other OOD?

#4

Hi, I-am iPhone 7 user. I recently got a software update for 11.3.3 version. After the update the phone was restarted, as usual. All the apps of the phone are working well, except the Meteor app that’s really not working. I have even tried to install the app again but it doesn’t helps. Please help me solve this issue. :grinning::grinning: