What's the worst coding practices you have seen(or done!)?View other answers to this thread
Learn Something New Everyday,
Connect With The Best Developers!
Sign Up Now!
I'm a React Native Developer so my answer will be in that context.
- Global Variables: I used to define at the very start of my career.
- 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.
- Inline CSS: It's a good practice to define a StyleSheet outside the render method because it keeps taking memory on every rerender.
- 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.
- 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.
- 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.