javascript - get jsx compiler to ignore lines referring to other APIs -



javascript - get jsx compiler to ignore lines referring to other APIs -

i'm using react.js create components in chrome content script.

the react components should re-render when info in local storage changes.

readuserinfo : function() { chrome.storage.onchanged.addlistener(function(object changes, string areaname) { this.setstate({userinfo:changes["userinfo"].newvalue}); });

with mount function

componentdidmount: function() { this.readuserinfo(); }

of course of study jsx compiler complains chrome api calls. how can jsx compiler ignore line, i.e. leave vanilla js?

try instead:

componentdidmount: function() { chrome.storage.onchanged.addlistener(this.onchromestoragechange) }, onchromestoragechange: function(changes, areaname) { this.setstate({ userinfo:changes["userinfo"].newvalue }) }

i used react’s autobinding , removed invalid argument look had (probably copy/pasted docs). don’t forget remove listener when component unmounts.

javascript google-chrome-extension reactjs content-script react-jsx

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -