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.


Author of content
Edit this page

Made by Michael Sakhniuk

Twitter