Skip to content

Commit

Permalink
Use short circuit evaluation in render
Browse files Browse the repository at this point in the history
  • Loading branch information
Santamaura committed Aug 5, 2021
1 parent 34c6ad4 commit c2f320a
Showing 1 changed file with 14 additions and 4 deletions.
@@ -1,3 +1,13 @@
// Copyright 2021 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

import React from "react";
import { useSelector } from "react-redux";

Expand All @@ -15,8 +25,10 @@ const FeedBackSurveyLink = () => {
const feedbackLink = new URL("https://www.cockroachlabs.com/survey/");
feedbackLink.searchParams.append("clusterId", clusterId);
feedbackLink.searchParams.append("clusterVersion", singleVersion);

return clusterId && singleVersion ? (
if (!clusterId || !singleVersion) {
return <></>;
}
return (
<div
className="feedback-survey-link"
onClick={() => window.open(feedbackLink.toString())}
Expand All @@ -28,8 +40,6 @@ const FeedBackSurveyLink = () => {
/>
<div className="feedback-survey-link__title">Share feedback</div>
</div>
) : (
<></>
);
};

Expand Down

0 comments on commit c2f320a

Please sign in to comment.