Skip to content

Instantly share code, notes, and snippets.

@arnoldc
Last active February 27, 2023 17:05
Show Gist options
  • Select an option

  • Save arnoldc/fc0ad2a3474a9ea24c87b4e6c19e5771 to your computer and use it in GitHub Desktop.

Select an option

Save arnoldc/fc0ad2a3474a9ea24c87b4e6c19e5771 to your computer and use it in GitHub Desktop.
[React Native] Architecture Tips
// pattern 1 - component structure
index.tsx: The index file contains the business logic of the component such as data fetching,
as well as the connection to the global application state. It only renders the following .view component.
<component>.view.tsx: The view file contains the UI. It doesn’t hold its own state nor does it connect directly to the global application state. It only renders the props it gets from the index file.
<component>.styles.tsx: The styles file contains the React Native StyleSheet or the styled-components, depending on which approach you chose.
<component>.types.tsx: The types file provides the data type for props and the state of the index and view files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment