here is my react hooks code.
function onClick(){
alert('clicked')
}
var className='clicker'
function Clicker1(){
return <div {...{onClick,className}}>clicker 1</div>
}
function Clicker2(){
var props={onClick,className}
return <div {...props}>clicker 2</div>
}
function Clicker3(){
return <div className={className} onClick={onClick}>clicker 3</div>
}
function Clickers(){
return <><Clicker1/><Clicker2/><Clicker3/></>
}
ReactDOM.render(<Clickers/>,document.getElementById('root'));
It demonstrates three different styles of passing props to a component. They all work just fine. My favorite style is clicker 1.
my question is: is there a more concise way to pass the props?
edit: this question is not option-based, its about concise representation, which can be accurately measured in number of characters, no option needed