How to define constants in ReactJS

前端 未结 5 2162
无人共我
无人共我 2021-02-03 18:42

I have a function that maps text to letters:

sizeToLetterMap: function() { 
     return {
                small_square: \'s\',
                large_square: \'q\         


        
5条回答
  •  隐瞒了意图╮
    2021-02-03 18:55

    You can also do,

    getDefaultProps: ->
      firstName: 'Rails'
      lastName: 'React'
    

    now access, those constant (default value) using

    @props.firstName
    
    @props.lastName
    

    Hope this help!!!.

提交回复
热议问题