Set a variable using another variable or component property as a part of the variable name

Hello,

I am trying to build a component that will use a single string property to construct another variable to display data.

For example, lets say I have a view component that will display a recipe for a food, and I would like to enter the property as the name of the food (e.g. hamburger, cupcake, or salad) to set a private variable to the name of the food. Lets say I have passed cupcake as my property, and private variable.

I would then like to call an app or page variable built with the private variable so i hope for a way to do something like the following. pageVars.private variable+Recipe to get pageVars.cupcakeRecipe which would in turn call or bind the pageVars.cupcakeRecipe variable into my view component.

Hi, variable names cannot be set dynamically, since it would essentially be impossible to make a reference to them in a view component if the variable’s name could be anything. However, there are other ways to choose one item and display its details in a view component. For example, you could have a page variable called “chosenRecipe” that you populate with Set page variable flow function. In case you want to show one recipe per page, using a page parameter (tutorial) is a good idea.