+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.

...