-3

I pass a single argument to a react functional component. What I need, is to destructore classes from props, but remain props intact, so I can refer to a props like props.title inside the component, but use classes without writing props.classes, just classes.

My idea was to do something like this, but it is not working:

const reactComponent = (props, { classes } = props) => { ... }

Is it possible to do it in javascrpit? Thank you.

Tholle
  • 108,070
  • 19
  • 198
  • 189
exoslav
  • 2,094
  • 3
  • 21
  • 26

1 Answers1

-1

Sorry , just updated another correct way to achieve your goal:

const reactComponent = function({classes}){
  console.log(arguments[0],classes);
};

reactComponent({ classes: "test" });
Deng Zhebin
  • 1,222
  • 1
  • 9
  • 17