How to create a dynamic prop name in React?

后端 未结 3 641
谎友^
谎友^ 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:58

    It's possible to do this with JSX syntax alone with spread attribute and computed property name:

    
    

提交回复
热议问题