Monaca Onsen UI Discord Chat Github Repo

Splitter ListItem Uncaught SyntaxError: Unexpected token (



  • I am trying to set up a Splitter menu with a logout ListItem. Unfortunately when I click on logout I get the error in the title. If I debug the source at (index):1 then I get

    function () {
          var _this4;
          return (_this4 = _this).__logoutHandler__REACT_HOT_LOADER__.apply(_this4, arguments);
        }
    

    As you can see the function has no name which agrees with the error. Below is render() of MainPage.js

    render() {
        const { trips, navigator } = this.props;
        return (
          <Splitter >
            <SplitterSide id="menu" side="right" width="120px" collapse>
              <Page>
                <List>
                  <ListItem onclick={this.logoutHandler} tappable>
                    <p >&nbsp;&nbsp;&nbsp;Logout</p>
                  </ListItem>
                </List>
              </Page>
            </SplitterSide>
            <SplitterContent id="content">
              <Page renderToolbar={() => <NavBar showMenuHandler={this.showMenuHandler} navigator={navigator} />}>
                <AddTripButton clickHandler={this.addTrip} />
                <Card>
                  <div className="content">
                    {trips && <TripList trips={trips} navigator={navigator} />}
                  </div>
                </Card>
              </Page>
            </SplitterContent>
          </Splitter>
        )
      }
    

    logoutHandler dispatches an action

    logoutHandler = () => {
      this.props.actions.logout()
    }
    

    If I substitute logoutHandler in the render code above like this:-

    NavBar showMenuHandler={this.logoutHandler}
    

    then logoutHandler is called OK when I click on the menu icon, which suggests that there is something wrong with ListItem. Unfortunately I cannot get any further witht the debugging. Any ideas?

    OnsenUI noob



  • In Firefox I get

    SyntaxError: function statement requires a name[Learn More]
    

    I am using 2.10.5