[Discuss] Best way to separate functions to reuse-able
See original GitHub issueHi, I’ve been using react-rails for almost year. I have a lot of modules and files that doing its job but some files and modules used same custom function (repeat code). I would like to know how you guys action with this situation like me.
In my mind just put into the .js file and include its into the application.js
file. it’s ok to do so?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
4. Code Reuse: Functions and Modules - Head First Python ...
Take a collection of functions and package them as a file, and you've got a module (which can also be reused). It's true...
Read more >Functions — reusable blocks of code - Learn web development
In this article we'll explore fundamental concepts behind functions such as basic syntax, how to invoke and define them, scope, and parameters.
Read more >4 Ways to Make Your Code More Reusable | by Lance Harvie
Plan and identify the parts of your software which needs to be divided into chunks. Divide a software system into multiple independent ...
Read more >How to Maximize Your Ability to Reuse Code Across Projects
The following are some common ways to identify and implement separate components of reusable code for speedy development, using less time ...
Read more >Reusable and modular code with functions
Functions wrap up reusable pieces of code - they help you apply the Do Not Repeat Yourself (DRY) principle. Suppose that separating large...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have a
utils.js
that I require in each JS file that I need it. Must say I’m slightly out of date with the latest trends so idiomatic react might have a different way of doing it. Generally I’m a big fan of the simplest thing that works.Going to close for now as I believe this has been answered.