//declaring arrow function
hello = () => {
return "hello world";
}
import React from 'react'
const buttons = () => {
return (
<div>
</div>
)
}
export default buttons
import React from 'react'
const HomePage = () => {
return (
<div>HomePage</div>
)
}
export default HomePage
npm install --save-dev @babel/plugin-proposal-class-properties
run this in terminal to run arrow functions .
ig-kiritocode1
const App = () => {
return (
<div>
<h1>List of Courses</h1>
<hr />
<CoursesList courses={courses} />
</div>
);
}
//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.