Fellow Stranger Fellow Stranger - 2 months ago 5x
Javascript Question

Curried function where ES7 property initializers aren't enabled

I have the following arrow function in a so called curried format, taken from this SO answer:

const getIntervals = n=> availability=> {}

I need to use it in a React component, written in ES6 syntax, that cannot handle ES7 property initializers due to the implementation.

"Normally" a function in a class context in React has this simple style:

myFunction () {}

But would I convert the
function to this style?


Just define getIntervals as a regular method, but have it return your curried function:

class Example extends Component {
   getIntervals(n) {
      return (availability) => {

   render() {...}