---
# System prepended metadata

title: React Native Interview Question

---

# React Native Interview Question

#### While work with react navigation in react native, how do we find out that a user is leaving (blur) it or coming back to it (focus) ?

###### `Hint: Have you heard useFocusEffect ?`


###### Method 1 : Can listen to focus and blur events to know when a screen comes into focus or goes out of focus with `useEffect`.

###### Method 2 : Instead of adding event listeners manually, we can use the `useFocusEffect` hook to perform side effects. It's like React's useEffect hook, but **it ties into the navigation lifecycle**.

>reference : https://reactnavigation.org/docs/navigation-lifecycle/#react-navigation-lifecycle-events

#### The difference between useFocusEffect and useEffect hook ?

###### The only difference is that it only runs if the screen is currently focused.

>reference : https://reactnavigation.org/docs/use-focus-effect/#:~:text=The%20useFocusEffect%20is%20analogous%20to,the%20dependencies%20passed%20to%20React.


#### What kinds of tool you often debug with React Native applications ?

###### Flipper is a highly extensible mobile app debugger used to debug iOS, Android and React Native applications. It lets you inspect, control, and visualize your application from its desktop application.

> reference : https://github.com/facebook/flipper

#### Have you ever implement CodePush in React Native ? When should I use it in react native project ?

###### Hint: CodePush, a cloud service managed by Microsoft AppCenter, allows developers to instantly deploy mobile updates to end users. 
###### CodePush synchronizes JavaScript code with any updates released to the CodePush server, meaning you don’t have to update your app in either app store.

>reference : https://github.com/microsoft/react-native-code-push

#### Have you ever write a native module for your React Native application ?

###### There are two ways to write a native module for your React Native application:

###### 1. Directly within your React Native application’s iOS/Android projects
###### 2. As a NPM package that can be installed as a dependency by your/other React Native applications


>reference : https://reactnative.dev/docs/native-modules-intro




---

##### 額外補充資訊分享

###### 需要定期關注 apple store and google play 釋出的政策

###### `舉例來說：`

##### Account deletion within apps Reqirements by apple (註冊會員 要有讓使用者可以刪除會員的功能)

> reference : https://developer.apple.com/news/upcoming-requirements/?id=06302022b

##### User Generated Content by googleplay (如果平台提供使用者自由發表公開言論 要讓使用者 可以屏蔽 封鎖 舉報 不舒服的留言)

> reference : https://support.google.com/googleplay/android-developer/answer/9876937?hl=zh-Hant#zippy=