简体   繁体   English

如果仅在 React 组件中收到道具,如何渲染

[英]How to render if only received props in a react component

PropTable should render only if receives props from other component PropTable 只有在从其他组件接收到道具时才应该渲染

const PropTable = (props) => {
  const { availableProp } = props;
...
return(...)
}

This'd get your job done这会完成你的工作

const PropTable = (props) => {
  const { availableProp } = props;
...
return availableProp ? (...) : null
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM