を反応させる:modal-galleryJavaScriptのシンタックスは、私がここに反応するルータコードに行っていたルート
と、この構文に出くわした
const Modal = ({ match, history }) => {
const image = IMAGES[parseInt(match.params.id, 10)]
if (!image) {
return null
}
const back = (e) => {
e.stopPropagation()
history.goBack()
}
return (
<div
onClick={back}
style={{
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
background: 'rgba(0, 0, 0, 0.15)'
}}
>
<div className='modal' style={{
position: 'absolute',
background: '#fff',
top: 25,
left: '10%',
right: '10%',
padding: 15,
border: '2px solid #444'
}}>
<h1>{image.title}</h1>
<Image color={image.color} />
<button type='button' onClick={back}>
Close
</button>
</div>
</div>
)
}
私の質問は、このどのようなタイプの構文のですか?これをどのように変換しますかES6 React.Component class
これは、分割代入と呼ばれています。 – Li357
これはJavaScriptではありません。最終的に尋ねられる現象がJavaScriptとJSXの両方で利用可能であるとしても、おそらく[tag:jsx]でタグ付けされるべきです。 – Amadan