Closed alexlovo closed 3 years ago
can you create a sample codesandbox or attach the sample code here with screenshots @alexlovo
<Navigation
activeItemId={location.pathname}
onSelect={({ itemId }) => { history.push(itemId); }}
items={[
{
title: "Home",
itemId: "/",
elemBefore: () => <FontAwesomeIcon icon={faHome} />
},
isAuthorized ? { //authorized is true or false
title: "Profile",
itemId: "/profile",
elemBefore: () => <FontAwesomeIcon icon={faUser} />,
} : "", // or adding an empty object {} instead of ""
]} />
Above is the sample, but its due to the div within the ul that it makes it look like something is there. Also it adds it because it iterates through each item regardless if its empty string ("") or empty object ({})
@alexlovo this can be resolved with conditional spreading
closing. feel free to re-open if it doesn't solve your issue
Yes that did work, I see what you mean now. Thank you for your quick response.
Is there a way to hide the
if its an empty object {}? It shows the div and pushes the rest downward making it look awkward when hiding according to a variable