sudheerj / reactjs-interview-questions

List of top 500 ReactJS Interview Questions & Answers....Coding exercise questions are coming soon!!
38.89k stars 9.24k forks source link

For Naming Convention of React props #239

Closed BrockDW closed 1 year ago

BrockDW commented 1 year ago

Hello Dear Sudheerj,

Thanks a lot for creating such a list of questions to help us prepare for the interview.

But for the number 10 in reactjs-interview-questions Props are inputs to components. They are single values or objects containing a set of values that are passed to components on creation using a naming convention similar to HTML-tag attributes. They are data passed down from a parent component to a child component. After some checking, I find out that React prop naming convention is generally camelCase. But there is no finite answer for HTML-tag Attributes naming convention. Some are using kebab-case, and some are using snake_cases. Would it be better if we can change this line so it is clear when talking about name convention?

But generally, it doesn't matter, since naming is usually a habit and doesn't effect coding that much.

Also if I am making any mistake, feel free to let me know.

Sincerely, BrockDW

sudheerj commented 1 year ago

Thank you @BrockDW for the details. I will update the answer for the same.