Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const [open, setOpen] = React.useState(false);
const currentUser = useGlobalState(m => m.user);
const menuItems = useGlobalState(m => m.components.menuItems);
const itemNames = Object.keys(menuItems).filter(m => menuItems[m].settings.type === 'user');
const container = React.useRef(undefined);
const image = currentUser ? require('../images/male.png') : require('../images/female.png');
const items = itemNames.length > 0 && (
<>
<li>
{itemNames.map(name => {
const Component = menuItems[name].component;
return ;
})}
);
useOnClickOutside(container, () => setOpen(false));
return (
<div open="">
<div> setOpen(!open)}>
<img alt="Profile Image" src="{image}">
</div>
<ul>
{currentUser ? (
<>
<li>
<span>Name</span>
{currentUser.firstName} {currentUser.lastName}
</li>
{items}
<li>
</li><li></li></ul></div></li>
const LanguagePickerView: React.FC = ({ selected, available }) => {
const [open, setOpen] = React.useState(false);
const [language, setLanguage] = useDynamicLanguage(selected, loadLanguage);
const container = React.useRef();
const translate = useTranslate();
useOnClickOutside(container, () => setOpen(false));
return (
<div>
<div> setOpen(!open)}>
</div>
<ul>
{available.map(lang => (
<li> setLanguage(lang)}>
<span>{translate(lang)}</span>
</li>
))}
</ul>
</div>
);
};