react native - getInitialState not working in Movies Tutorial -
trying follow react native tutorial movies app. using ios or android goes fine until try introduce state component. tutorial not use es6 classes hello world app , gets confusing.
the tutorial says add getintialstate
breaks assume due using es6 classes, using constructor not seem work wanted know correct way proceed?
tutorial
getinitialstate: function() { return { movies: null, }; },
es6 equivalent?
constructor(props) { super(props); this.state = { movies: null, }; },
do not use comma (,) after methods in class!
class listapp extends component { constructor(props){ super(props); this.state = { loaded: false }; } //, <--- no comma! ... ... ... }
Comments
Post a Comment