+1 vote
in ReactJS by

How to define constants in React?

1 Answer

0 votes
by

You can use ES7 static field to define constant.

class MyComponent extends React.Component {
  static DEFAULT_PAGINATION = 10
}

Static fields are part of the Class Fields stage 3 proposal.

Related questions

0 votes
asked Oct 6, 2021 in Kotlin by Robin
0 votes
asked Nov 4, 2023 in ReactJS by AdilsonLima
...