Difference between two places of declaring functions in ReactVery basic isomorphic JavaScript...

VAT refund for a conference ticket in Sweden

What is this waxed root vegetable?

How can I create a Table like this in Latex?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Don't know what I’m looking for regarding removable HDDs?

How can I handle a player who pre-plans arguments about my rulings on RAW?

Test pad's ESD protection

What could trigger powerful quakes on icy world?

Why is it "take a leak?"

Detect if page is on experience editor Sitecore 9 via Javascript?

Heating basement floor with water heater

Rationale to prefer local variables over instance variables?

What are the issues with an additional (limited) concentration slot instead of Bladesong?

It took me a lot of time to make this, pls like. (YouTube Comments #1)

What is better: yes / no radio, or simple checkbox?

Did Amazon pay $0 in taxes last year?

What type of investment is best suited for a 1-year investment on a down payment?

Is divide-by-zero a security vulnerability?

Inverse of the covariance matrix of a multivariate normal distribution

What am I? I am in theaters and computer programs

lead or lag function to get several values, not just the nth

Where is the fallacy here?

Make me a metasequence

How to lift/raise/repair a segment of concrete slab?



Difference between two places of declaring functions in React


Very basic isomorphic JavaScript applicationExercise: Build a news page with React & React RouterReact component to list TV shows from a JSON resultAn Mp3 player using React and Redux and the HTML5 web audio APIRendering two logos in a React search componentSimple blog using react redux react-routerFiltered table in React.jsRender a variable image of a flag in React NativeReacting to moods with iconsHeader navigation with React













0












$begingroup$


I'm working on getting familiar with React. Whats the difference between the two approaches to declaring the onCellClick function (whether it be called onCellClick or concatenateClickedString)



class App extends React.Component {
constructor(){
this.onCellClick = this.onCellClick.bind(this);
}
render(){ <div onClick={this.onCellClick} }
onCellClick(){}
}


class App extends React.Component {
constructor(){
}
render(){ <div onClick={onCellClick} }
onCellClick(){}
}
function onCellClick(){}








share









$endgroup$

















    0












    $begingroup$


    I'm working on getting familiar with React. Whats the difference between the two approaches to declaring the onCellClick function (whether it be called onCellClick or concatenateClickedString)



    class App extends React.Component {
    constructor(){
    this.onCellClick = this.onCellClick.bind(this);
    }
    render(){ <div onClick={this.onCellClick} }
    onCellClick(){}
    }


    class App extends React.Component {
    constructor(){
    }
    render(){ <div onClick={onCellClick} }
    onCellClick(){}
    }
    function onCellClick(){}








    share









    $endgroup$















      0












      0








      0





      $begingroup$


      I'm working on getting familiar with React. Whats the difference between the two approaches to declaring the onCellClick function (whether it be called onCellClick or concatenateClickedString)



      class App extends React.Component {
      constructor(){
      this.onCellClick = this.onCellClick.bind(this);
      }
      render(){ <div onClick={this.onCellClick} }
      onCellClick(){}
      }


      class App extends React.Component {
      constructor(){
      }
      render(){ <div onClick={onCellClick} }
      onCellClick(){}
      }
      function onCellClick(){}








      share









      $endgroup$




      I'm working on getting familiar with React. Whats the difference between the two approaches to declaring the onCellClick function (whether it be called onCellClick or concatenateClickedString)



      class App extends React.Component {
      constructor(){
      this.onCellClick = this.onCellClick.bind(this);
      }
      render(){ <div onClick={this.onCellClick} }
      onCellClick(){}
      }


      class App extends React.Component {
      constructor(){
      }
      render(){ <div onClick={onCellClick} }
      onCellClick(){}
      }
      function onCellClick(){}






      react.js





      share












      share










      share



      share










      asked 5 mins ago









      SweetTomatoSweetTomato

      262




      262






















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214807%2fdifference-between-two-places-of-declaring-functions-in-react%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214807%2fdifference-between-two-places-of-declaring-functions-in-react%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

          How do i solve the “ No module named 'mlxtend' ” issue on Jupyter?

          Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...