DEV Community

Discussion on: What structure, operator or other thing do you use most in your daily development?

Collapse
 
alexandermirzoyan profile image
Alex Mirzoyan

In React there are a lot of packages for managing ternary operators for conditionally rendering some UI parts. It's really easy to even create such components by yourself.

I am sure that Angular also can have such approaches. Even if it is hard to find such kind of components I think it's better to move the conditional statement to Component file for making the code cleaner and more readable.

Attaching some packages for React.

npmjs.com/package/react-if
npmjs.com/package/react-conditiona...

P.S. If you wish I can share my own written solution for such kind of problem.

Collapse
 
renancferro profile image
Renan Ferro

Wow, really cool and interesting. I also like to keep everything well componentized to avoid duplication and make maintenance easier. Thanks for sharing!

Please, I'd love to see your solution!

Collapse
 
alexandermirzoyan profile image

Pushed the solution to GitHub.

Feel free for any kind of comments.

github.com/alexandermirzoyan/rc-co...