Musa BAL
Jan 17, 2021

isVisible — setState — ternary operatör

import React, { Component } from 'react'

class Satislar extends Component {

constructor(props) {

super(props)

this.state = {

isVisible: true

}

}

onClickEvent = (number, e) => {

let isVisible = this.state.isVisible

isVisible ? this.setState({ isVisible: false }) : this.setState({ isVisible: true })

}

render() {

let isVisible = this.state.isVisible

console.log(typeof (isVisible))

return (

<div>

<h3 onClick={this.onClickEvent.bind(this, 34)} >Satışlar Tablosu <br /> Satış yapılan Ürün:</h3>

{

isVisible ?

<div>

<h2 style={{ color: "chocolate" }}>{this.props.urunAdi}</h2>

</div> : null

}

</div>

)

}

}

export default Satislar;

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Musa BAL
Musa BAL

No responses yet

Write a response