Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Function declaration vs Function expression in React v2
(version: 0)
Comparing performance of:
function expression vs function declaration vs function expression var
Created:
3 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script> <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script> <div id="dest"></div>
Tests:
function expression
const Hello = ({toWhat}) => React.createElement('div', null, `Hello ${toWhat}`); ReactDOM.render( React.createElement(Hello, {toWhat: 'World'}, null), document.getElementById('dest') );
function declaration
function Hello ({toWhat}) { return React.createElement('div', null, `Hello ${toWhat}`); } ReactDOM.render( React.createElement(Hello, {toWhat: 'World'}, null), document.getElementById('dest') );
function expression var
const Hello = ({toWhat}) => React.createElement('div', null, `Hello ${toWhat}`); ReactDOM.render( React.createElement(Hello, {toWhat: 'World'}, null), document.getElementById('dest') );
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
function expression
function declaration
function expression var
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Function declaration vs Function expression in React
React Const vs Function - fixed
React Const vs Function - fixed2
React Const vs Function (3)
Comments
Confirm delete:
Do you really want to delete benchmark?