I have a function that creates objects, but I want to receive the key for that object by parameter. How do I set this key? When I put the parameter the function does not take and sets the name of that parameter as the key
My code:
createData = (image, text, id) => {
  return {
    id: {
      image,
      text,
    },
  };
};

 
     
     
    