Skip to content

Instantly share code, notes, and snippets.

View sakibrahmanchy's full-sized avatar

sakibrahmanchy sakibrahmanchy

View GitHub Profile
Problem 1: All the data will be rendered after all api calls are completed
Problem 2: Possible issue of race condition on very fast load
Problem 3: Sometimes state can be replaced by wrong data (stale data)
Solution: Use Suspense & SuspenseList
```
import React, { Suspense, SuspenseList, useState } from "react";
import ReactDOM from "react-dom";
class UserController {
private $input = array(
2 => [
'user_id' => 2,
'user_name' => 'Mr. Abdul Kalam',
'age' => 53,
]
);
private $user_id = 2;