scrimba
Learn React for free
React Conditional Render Part 2
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

React Conditional Render Part 2
AboutCommentsNotes
React Conditional Render Part 2
Expand for more info
App.js
run
preview
console
import React, {Component} from "react"
import Conditional from "./Conditional"

class App extends Component {
constructor() {
super()
this.state = {
unreadMessages: [
"Call your mom!",
"New spam email available. All links are definitely safe to click."
]
}
}

render() {
return (
<div>
<h2>You have {this.state.unreadMessages.length} unread messages!</h2>
</div>
)
}
}

export default App
Console
index.html
-2:50