React Js Interview Question

Photo by MedicAlert UK on Unsplash
render() {
if (this.state.isLoading) {
return <div>Loading...</div>;
} else {
return <div>Hello, World!</div>;
}
}
render() {
return this.state.isLoading ? <div>Loading...</div> : <div>Hello, World!</div>;
}
render() {
return this.state.isLoading && <div>Loading...</div>;
}
renderContent() {
if (this.state.isLoading) {
return <div>Loading...</div>;
}
return <div>Hello, World!</div>;
}

render() {
return <div>{this.renderContent()}</div>;
}
//
getContent() {
if (this.state.isLoading) {
return <div>Loading...</div>;
}
return <div>Hello, World!</div>;
}

render() {
const content = this.getContent();
return <div>{content}</div>;
}

--

--

Neeraj Dana

Experienced Software Engineer with a demonstrated history of working in the information technology and services industry. Skilled in Angular,React,React-Native,