Answer the question
In order to leave comments, you need to log in
Is wrapping string properties in curly braces considered a bug in React?
For example, there is a certain component (Component) with a property name (propTypes.string). If I write in the environment <Component name={'test'} />
, then the environment automatically adds curly braces. During the review, they say that they should not be used for strings.
Is that bad tone? Mistake?
I myself think that if the brackets are added - there is nothing wrong with that, moreover, when adding an expression in the future, you won’t have to add brackets.
Thanks for answers.
Answer the question
In order to leave comments, you need to log in
In fact, this is a style guide question, how do you agree to write in a team.
From the point of view of the language, if the expression is constant, then the brackets are not needed. They are needed to use standard JS constructs in JSX.
"when adding an expression in the future" - in the future and add. Perhaps this future will not come :).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question