How to create a dynamic prop name in React?

后端 未结 3 644
谎友^
谎友^ 2021-01-31 15:34

Is it possible to create the name of a prop dynamically? For example:

let dynamicPropName = \"someString\";

         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 15:51

    An inline way (very ugly and not recommended) is using a expression to define an object:

    
    

提交回复
热议问题