Here is an example:
class MyComp extends React.Component {
constructor(props) {
super(props);
this.state = {
firstName: 'xyz',
lastName: 'abc';
fullName: firstName + lastName
};
}
Trying the above technique gives me errors. I also tried using this.firstName
and this.lastName
but that also resulted in errors. How should I proceed?
Thanks.