React signals wont render async data

66 Views Asked by At

In the React component below, I want to fetch data from the server and then present it in component html, the data is arriving and i can see in the console.lo, but the component wont be rendering it.

  1. Why the data is not shown in the html even though console.log shows the data?
  2. Is this the case for signal? createSignal? useSignal?
export const ManagementUsersList = () => {
  const list = signal([]);

  effect(() => {
    client()
      .get('/user')
      .then(({ data }) => {
        console.log(data);
        list.value = data;
      });
  });

  return (
    <div>
      {JSON.stringify(list.value)}
    </div>
  );
};
0

There are 0 best solutions below