What’s the ‘@’ (at symbol) in the Redux @connect decorator?

I am learning Redux with React and stumbled upon this code. I am not sure if it is Redux specific or not, but I have seen the following code snippet in one of the examples.

@connect((state) => {
  return {
    key: state.a.b
  };
})

While the functionality of connect is pretty straightforward, but I don’t understand the @ before connect. It isn’t even a JavaScript operator if I am not wrong.

Can someone explain please what is this and why is it used?

Update:

It is in fact a part of react-redux which is used to connects a React component to a Redux store.

2 Answers
2

Leave a Comment