Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

React: Render with if statement HTML

26.02.2021 (👁2116)


For status-related displays of HTML elements, you can either define an if ( range ) directly in the render() block or

 

{

this.state.ok === true && (

 //--< Buttons >--

 <Link href="/" onClick={this.onClickSubmit}>

  <Fab color="secondary" >

   <RemoveRedEye />

  </Fab>

 </Link>

 )

 //--</ Buttons >--

}

 



embed expressions in JSX

{ state-Wert mit && ( HTML ) }

 

True

At this.state.visible_Variable = true

 

 

False

At this.state.visible_Variable = false

 

 

Die State Variable sollte im Contructor definiert sein.

export class Edit extends Component {

    //--------< component: Article >--------

    //----< compontent >----

    baseURL = "/";

    constructor(props) {

        //-< react: parameter >

        super(props);

        //-</ react: parameter >

        //--< react: variables >--

        this.state = {

            idarticle: 0,

            iduser: "",

            title: "",

            textcontent: "",

            htmlcontent: "",

            folder: "",

            keywords: "",

            nimages: "",

            nvideos: "",

            nfiles: "",

            dtcreated: "",

            dtedit: "",

            loading: true,

            status: "",

            ok: false,

        }

        this.onClickSubmit = this.onClickSubmit.bind(this); //for using this.function() in component

    }