I have an array:
const names = [
{
id: 1,
name: "one"
},
{
id: 2,
name: "two"
}
];
then in jsx I have to call a function which is outside of the loop.
const renderSomething = (obj: any) => obj.name + " "; //obj type should not be any
How can I declare obj equal to objectOf names in typescript?
demo: https://codesandbox.io/s/react-typescript-forked-yvt0gj