Check if property exists using React.js

前端 未结 6 1744
悲哀的现实
悲哀的现实 2020-12-29 21:42

I\'m new to using react.js, and am trying to write a re-usable component that has an optional property passed to it. In the component, that optional property pulls data from

6条回答
  •  独厮守ぢ
    2020-12-29 22:30

    You need to return out of getParentTaskLink() with the link you need.

     if (current_task.parent_task) {
          return (link);
        } else { return null; }
    

提交回复
热议问题