Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

How to name component props? Best practice

$
0
0

While developing custom component for Dash, i often add new props. Is there some best practices on how to name these them (maybe @chriddyp or @alexcjohnson can shred some light)?

Take for example the GeoJSON component that i am working on. I guess that for props that are mapping 1:1 of the underlying object (e.g. the pointToLayer prop), the name should be kept the same (it makes the structure more transparent, and makes it possible to reuse documentation). But what about new props? Consider e.g the prop that holds the last feature clicked. How should it be named?

  • feature_click
  • click_feature
  • featureClick
  • clickFeature

At the moment i am using snake case for Dash specific props with the event first, i.e. click_feature for this prop. However, props that would be relevant in a general React context (e.g. the hoverStyle prop), i tend to name with camelcase.

Any comments/suggestions are appreciated :slight_smile:

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images