Shared Resources
Shared Resources
In modern web and mobile development, sharing resources across different parts of an application is crucial for maintaining consistency and reducing redundancy. Below are some common types of shared resources:
Common Components
Common components (packages/components/common/
) are reusable components/pages that are used across different parts of an application. These components are designed to be generic and flexible, allowing them to be easily integrated into both expo, next (web and native). e.g. - Header
, Sidebar
, Footer
etc.
Module-specific Components
Module-specific components (packages/modules/<modules-name>/components/
) are specific to particular modules or features of an application. These components are tailored to the needs of a specific module like authentication, file-upload, profile-data. Examples include a SignInForm
component in auth
module.
Common Assets
Common assets include images, icons, fonts, and other media files that are used throughout the application. These assets are stored in a centralized location to ensure consistency and ease of access. Examples include a company logo, common icons, and shared background images.
Module-wise Assets
Module-wise assets are specific to particular modules or features of an application. These assets are used only within the context of their respective modules. Examples include product images in an e-commerce module or user avatars in a social networking module.
Shared Pages Between Expo and Next.js
When developing applications that target both web and native platforms, it is essential to share as much code as possible to reduce duplication and maintenance efforts. Expo and Next.js are popular frameworks for building native and web applications, respectively. Shared pages between Expo and Next.js can include common layouts, navigation structures, and even entire screens that are designed to work seamlessly on both platforms. This approach allows developers to write code once and deploy it across multiple platforms, ensuring a consistent user experience.