What's the worst coding practices you have seen(or done!)?


I'm a React Native Developer so my answer will be in that context.

  1. Global Variables: I used to define at the very start of my career.
  2. Arrow functions inside render method: For the first 4 months, I think. Then I had to implement a FlatList and optimizing it taught me a lot about rerendering.
  3. Inline CSS: It's a good practice to define a StyleSheet outside the render method because it keeps taking memory on every rerender.
  4. I used to write code with proper indentation and format then I enabled format code each save setting in VS Code and it's so much productive now.
  5. Using for loops: Can't say it's a bad practice but using Array Higher-Order Functions like map and reduce is so much efficient and code is more readable too.
  6. Using recursive functions everywhere: When I first learned Recursive, I started using it everywhere which is bad. If the stack is going to be large then it will take a huge amount of memory and you might run into stack overflow. It's important to know when to iterate and when to use recursion. Yup, that's pretty much it.

With given use cases, moving to map, reduce, filter etc from for-loops are so much fun to write and relaxing to read! Fully agree with you..

Reply to this…

(11 answers) Take me to the question