score:0

if i correctly understand your problem. you need set default state for avoid null data

if you use class component in constructor of class you should set default value of state

class somecomponent extends react.component {
   constructor(props) {
    super(props);
    this.state = {
         somedata: []
    };
   }
}

if you use functional component you should use react hooks

const somecomponent = () => {
   const [items, setitems] = usestate([]); // default value empty array
};

score:0

open your model based on condition like -

               <div classname="template-profile">
                    <image
                        url={this.state.selectedimages.profilepicture}
                        mode={"profile"}
                    />
                    <h6>hello i'm</h6>
                    <h1 classname="template-profile-name">
                        nabnit jha
                    </h1>
                    <h6>
                    {this.state.aboutmetext} // here state value display successfully
                    </h6>
                    <div classname="template-self-info">
                        {modelstatus&&<modals modalbody={this.state.aboutmetext} modalheading="about me"></modals>}
                        //here state value became null
                    </div>
                </div>

function to make it true

function clickhandle

clickhandle=()=>{
  this.setstate({modelstatus:true})
}

you use your function based on your requirement.


Related Query

More Query from same tag