Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

use const when declaring an arrow function in React class component

//Error:The 'const' modifier can only be used in TypeScript files.
If you're creating an instance method(method inside a class component), 
then no you don't need const. 

If you're creating a generic (i.e. utility) function OUTSIDE of a component, 
then yes you probably should use const.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #const #declaring #arrow #function #React #class #component
ADD COMMENT
Topic
Name
5+1 =