In my React Native 0.59 App.js, 2 props are passed into each component:
const data = this.props.navigation.state.params.data;
const EventWithSelf = (props) => (<Event {...props} myself={data.myself} token={data.result} />)
const NeweventWithSelf = (props) => (<NewEvent {...props} myself={data.myself} token={data.result} />)
Since there is {...props} passed in for other props which may be needed for the component, do I have to initialize the component explicitly with constructor and run super(props) like below?
export default class Event extends React.Component {
constructor(props) {
super(props);
this._isMounted = true;
this.state = {
activeEvents: [],
user: this.props.myself,
token: this.props.token,
};
};
//more code
Or I can go without constructor like below as well:
export default class Event extends React.Component {
state = {
activeEvents: [],
user: this.props.myself,
token: this.props.token,
};
//more code.........
Without explicit constructor, where is the better place to initialize this._isMounted = true?