How to Call a Function inside a Render in React/Jsx

lost9123193

I want to call a function inside some embedded html. I tried the following but the function isn't called. Would this be the incorrect way of calling a function inside a render method?

import React, { Component, PropTypes } from 'react';

export default class PatientTable extends Component {
      constructor(props) {
        super(props);
        this.state = { 
         checking:false
      };
        this.renderIcon = this.renderIcon.bind(this);
  }

  renderIcon(){
    console.log("came here")
    return(
      <div>Function called</div>
    )
  }

  render() {

   return (
       <div className="patient-container">

       {this.renderIcon}      

      </div>
   );
 }
}
dknaack

To call the function you have to add ()

{this.renderIcon()}   

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to call function inside reactjs render method properly?

From Dev

How to call a function in the render function?

From Dev

How to call a function in the render function?

From Dev

How to call a function inside SpookyJS?

From Dev

How to call function inside the IIFE

From Dev

How to call a function inside constructor

From Dev

how to call function inside a trigger?

From Dev

How to call a function inside a class

From Dev

How to call a function inside SpookyJS?

From Dev

How to call function inside the IIFE

From Dev

How to call a function inside an iframe

From Dev

How to do the comparison using if inside the render function

From Dev

How to do the comparison using if inside the render function

From Dev

how to only render one view inside of the epoxy render function

From Dev

How can I call a function inside of a function?

From Dev

How to call function inside a main function in MATLAB?

From Dev

How do I call a function inside a function

From Dev

How to call a function inside a main function in javascript

From Dev

How call a function inside another function

From Dev

How to call a inherited function inside a callback function

From Dev

how to call function that is inside a function ready()?

From Dev

How to call a function that is inside another function javascript

From Dev

How to call a function inside a main function in javascript

From Dev

How to call a function that is inside another function?

From Dev

how to call function inside a function with setTimeout

From Dev

How to call a function defined in the controller inside of the view?

From Dev

How to call calling a function inside a Template literal

From Java

How to call an async function inside a UseEffect() in React?

From Dev

How to call an external function from inside a plugin

Related Related

  1. 1

    how to call function inside reactjs render method properly?

  2. 2

    How to call a function in the render function?

  3. 3

    How to call a function in the render function?

  4. 4

    How to call a function inside SpookyJS?

  5. 5

    How to call function inside the IIFE

  6. 6

    How to call a function inside constructor

  7. 7

    how to call function inside a trigger?

  8. 8

    How to call a function inside a class

  9. 9

    How to call a function inside SpookyJS?

  10. 10

    How to call function inside the IIFE

  11. 11

    How to call a function inside an iframe

  12. 12

    How to do the comparison using if inside the render function

  13. 13

    How to do the comparison using if inside the render function

  14. 14

    how to only render one view inside of the epoxy render function

  15. 15

    How can I call a function inside of a function?

  16. 16

    How to call function inside a main function in MATLAB?

  17. 17

    How do I call a function inside a function

  18. 18

    How to call a function inside a main function in javascript

  19. 19

    How call a function inside another function

  20. 20

    How to call a inherited function inside a callback function

  21. 21

    how to call function that is inside a function ready()?

  22. 22

    How to call a function that is inside another function javascript

  23. 23

    How to call a function inside a main function in javascript

  24. 24

    How to call a function that is inside another function?

  25. 25

    how to call function inside a function with setTimeout

  26. 26

    How to call a function defined in the controller inside of the view?

  27. 27

    How to call calling a function inside a Template literal

  28. 28

    How to call an async function inside a UseEffect() in React?

  29. 29

    How to call an external function from inside a plugin

HotTag

Archive