what is considered the best practice for string constants constants used throughout the entire application such as constants used in home screen and others, would it be considered good practice to combine them all in one file or to have multiple files- ( constants file for home screen and so on)
react native project structure with constants folder
1.9k views Asked by NQQ At
1
There are 1 answers
Related Questions in REACT-NATIVE
- ussd reader in Recket Native module
- I can't make TextInput to auto expand properly in Android
- expo config plugin use import instead of require
- Custom Sound for Expo Push Notifications Only Works in Foreground
- run RTK dispatch on gesture start with React Native
- Should I set Back-End for my React Native application?
- using infoPlist in app.json for expo project seems to not be working
- Anyone have success configuring react-native-home-indicator?
- KeyboardAvoidingView makes a messy the flexbox
- I am getting lots of errors when building react native app in Xcode
- Search and highlight text of current text in PDFKit Swift
- Flatlist Sometimes Capped at 10 Items Bug
- Is there any way to page transition in react native (stack navigation)
- Screen inside Stack.Navigator not visible in React-Native
- React Native stopwatch implementation slow on iOS
Related Questions in CONSTANTS
- const declaration - How to evaluate expressions at compile time?
- can I override c++ operator[] with only one function?
- String slice in a const function
- C++ Function overloading using const parameters
- Is there a good way to make runtime constants within methods in C#?
- C++ function with const pointer parameter
- More elegant enum / const declaration
- How can I ensure that my code properly handles the asynchronous nature of the Geolocation API callback in JavaScript?
- Why is it possible to change the value of an integer indirectly via a pointer to a constant int?
- Trouble accessing JSON object as a Constant in a Javascript Module
- Define a global Typescript const file in Angular
- Why can't you create const objects without the class meeting the conditions, in Dart
- K&R C programming language book. Section 1.4 about Symbolic Constants. Why to use them?
- Store constants in a file, use for module Instantiation in generate block
- How to declare a const and non-const operator overload in one declaration (templately)?
Related Questions in PROJECT-STRUCTURE
- Corect Maven project execution plugin configuration when using multimodule application
- Why Can't VS Code Directly Run Python unittest .py's Or Discover In Testing Tab
- I've renamed project directories on IntelliJ, and now, each launching, it recreates empty directories with the old names and an .iml file inside
- ImportError: No module named 'Shapes' when running Python scripts and tests
- How to Restrict Access to Maven automation testing framework Project's Main Folder Contents?
- How to share code auto-fill suggestions from a seperate instance of vs code
- Cross-platform app project structure in Python
- When to use multiple projects on the same Visual Studio solution?
- Better to have a contexts and providers folder or only a contexts folder in React project
- Correct python project structure and import statements
- Accessing ENV files in Vite Version 4
- Where should the benchmarks be put in a Java (Maven) project?
- Access Python Class Attribute inside externally called method
- Using Pycharm and using the same package in multiple projects - what's the best way to avoid duplicating the disk space it takes up?
- Refactoring Folder Structure for React and TypeScript Project with Three.js Business Logic
Related Questions in STRING-CONSTANT
- Why does __builtin_constant_p evaluate to false for a constexpr std::string_view argument?
- psql treating text input as column in a Join statement
- Setting a specific date in c++
- While Inserting Data Showing Data as does not exist
- Postgersql change the label for a query in case condition
- ERROR: syntax error at or near "a2e3916c" LINE 1: a2e3916c-dce2-11ec-a644-16e7866bc173 ^ SQL state: 42601 Character: 1
- INSERT INTO SELECT: mix between select column and plain values?
- When defining a new variable, how to decide its type according to the string value of a constant (or other variable)?
- Postgresql column not exists when trying to insert
- Why does postgreSQL detect this line as a column name?
- ERROR: column "USA" does not exist postgresql
- Column doesn't exist using CASE statement in PosgreSQL
- Why String doesn't use scp only
- Postgres mistaking value as a colum
- ORA-00984: column not allowed here - error at line 1 sql
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
There is no perfect answer to your question but just follow what makes sense to you and your project. You can also follow best practices. For example, an MVC-layered project will not have the same structure as a pure backend microservice. Still, these can have similar best practices.
To answer your question, a React Native project normally does not have a ton of constants, I don't see a real value in creating multiple files for constants. I would just have a
constants.jsfile under/src.If you still think multiple files are necessary, maybe having a
/constantsfolder under/srcwill keep it organized. You can also have anindex.jsfile.Furthermore, The Twelve-Factor App suggests having constants in environment variables. Obviously, this is not very practical for variables used with UI purposes, but rather variables that are part of the configuration of your project, such as database connections, URLs, etc.
Again, the short answer is to do what you think it's best for your project (scalability and deployments) and always trying to follow common best practices.