{"action":"opened","issue":{"url":"https://api.github.com/repos/developit/preact/issues/1155","repository_url":"https://api.github.com/repos/developit/preact","labels_url":"https://api.github.com/repos/developit/preact/issues/1155/labels{/name}","comments_url":"https://api.github.com/repos/developit/preact/issues/1155/comments","events_url":"https://api.github.com/repos/developit/preact/issues/1155/events","html_url":"https://github.com/developit/preact/issues/1155","id":335153581,"node_id":"MDU6SXNzdWUzMzUxNTM1ODE=","number":1155,"title":"how to call component instance method without event handle","user":{"login":"bung87","id":2238294,"node_id":"MDQ6VXNlcjIyMzgyOTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2238294?v=4","gravatar_id":"","url":"https://api.github.com/users/bung87","html_url":"https://github.com/bung87","followers_url":"https://api.github.com/users/bung87/followers","following_url":"https://api.github.com/users/bung87/following{/other_user}","gists_url":"https://api.github.com/users/bung87/gists{/gist_id}","starred_url":"https://api.github.com/users/bung87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bung87/subscriptions","organizations_url":"https://api.github.com/users/bung87/orgs","repos_url":"https://api.github.com/users/bung87/repos","events_url":"https://api.github.com/users/bung87/events{/privacy}","received_events_url":"https://api.github.com/users/bung87/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-24T05:55:30Z","updated_at":"2018-06-24T05:55:30Z","closed_at":null,"author_association":"NONE","body":"I what manually call loadding method,I checked the state changed but classNames() returns same as before;\r\n\r\n``` jsx\r\n/** @jsx h */\r\nimport { h, render, Component } from 'preact';\r\n\r\nexport class File extends Component {\r\n  BASE_ICON_CLASS = 'fas fa-cloud-upload-alt';\r\n\r\n  constructor() {\r\n    super();\r\n    this.setState({\r\n      state: 'initial'\r\n    });\r\n  }\r\n\r\n  classNames=() : string=> {\r\n    switch (this.state['state']) {\r\n      case 'loading':\r\n        return this.BASE_ICON_CLASS + ' fa-spinner fa-spin';\r\n      default:\r\n        return this.BASE_ICON_CLASS;\r\n    }\r\n  }\r\n  \r\n\r\n  loading = () =>{\r\n    console.log(\"this\",this)\r\n    this.setState({\r\n      state: 'loading'\r\n    });\r\n  };\r\n  \r\n  render({ id, text }) {\r\n    return (\r\n      <label class=\"file-label\">\r\n        <input\r\n          class=\"file-input\"\r\n          id={id}\r\n          type=\"file\"\r\n          name={name}\r\n        />\r\n        <span class=\"file-cta\">\r\n          <span class=\"file-icon\">\r\n            <i class={this.classNames()} />\r\n          </span>\r\n          <span class=\"file-label\">{text}</span>\r\n        </span>\r\n      </label>\r\n    );\r\n  }\r\n}\r\n\r\n```\r\n"}}
{"actor":{"display_login":"bung87"}}