Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Item: React.FC = ({ id, result }) => {
run(result, id); // only effective for the first render
return (
<div>
User ID: {id}
</div>
);
};
const UserData: React.FC = () => {
const [authState] = useContext(AuthContext);
if (!authState) throw new Error('no authState');
run(UserItems, authState);
return (
<ul>
{UserItems.data.map((item) => (
<li>{item.name}</li>
))}
</ul>
);
};