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;

--

--

Musa BAL
Musa BAL

No responses yet