Skip to content

Commit 2c8c60f

Browse files
corrected props function code
1 parent 62fd4d6 commit 2c8c60f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Debugging-Profiling/Debugging-and-Profiling-ultimate-guide.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,13 @@ React Native applications execute JavaScript code in a separate JavaScript engin
303303

304304
This is the thread where your actual React and JavaScript code gets executed. An example would be setting the state after fetching data from an API.
305305

306-
fetchData = async () => {
307-
const response = await fetch("https://api.example.com/data");
308-
const json = await response.json();
309-
this.setState({ data: json }); // this line is executed in the JS thread
310-
}
306+
```javascript
307+
fetchData = async () => {
308+
const response = await fetch("https://api.example.com/data");
309+
const json = await response.json();
310+
this.setState({ data: json }); // this line is executed in the JS thread
311+
};
312+
```
311313

312314
This entire operation runs on the JavaScript Thread.
313315

@@ -319,11 +321,13 @@ If you’re using **native code** in your React Native app, it gets executed her
319321

320322
A simple example would be creating a Toast module in Android.
321323

324+
```java
322325
// This is Java code that will run on the Native Modules Thread
323326
@ReactMethod
324327
public void show(String message, int duration) {
325328
Toast.makeText(getReactApplicationContext(), message, duration).show();
326329
}
330+
```
327331

328332
In this example, the `show` method will be invoked from JavaScript but run on the Native Modules thread.
329333

@@ -628,7 +632,3 @@ Don’t worry for upcoming versions of React Native. **you can still use Flipper
628632
Thank you for reading this article. I enjoy sharing my **5 years** of experience in **React-native**, **JavaScript**, **React** & **Node.js** with you every day. If you enjoyed reading this article, I would appreciate it if you could follow me on [**Twitter**](https://twitter.com/anis_RNCore) & [**Medium**](https://medium.com/@anisurrahmanbup).
629633

630634
If you find any **ISSUE** in this Guide BOOK, please create a **PR** to help the community 🔥
631-
632-
```
633-
634-
```

0 commit comments

Comments
 (0)