My React Native Journey - 4 - Understanding the App.JS file

Understanding the App.js file

Majorly, a single JS file contains four sections of code elements.

First, import statements to import required components from react, react-native and other modules.

Second, the App function written as
const App = () =>{}
read as Component App is of type function and whatever the function returns is rendered as a React Element.

Third, use a component called Stylesheet to create a CSS abstract 

const styles = Stylesheet.create({})
read as tell StyleSheet to create style objects with an ID, and return it to const styles.
These IDs are further used to reference instead of rendering.

Fourth and Finally, export default app is used to export a single class, function or primitive from a script file.


Now. with this background, I decide to follow this video to build a wordle clone.





Comments

Popular posts from this blog

Reading a pre-populated sqlite database using react native with expo..

React Hooks - useState Vs useRef (An explanation)