How to define constants in React?

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.


Made in India with ❤️ by Rajesh Kumar Yadav

Twitter