Question: I am sorry but I don't even know how to title this question since I have no clue what to look for.

Here is my problem: I have the following list:

| name | word | hit |
| --- | --- | --- |
| Bill | performance | 2 |
| Anna | performance | 5 |
| John | performance | 3 |
| Bill | java | 0 |
| Anna | java | 1 |
| John | java | 3 |
| Bill | test | 4 |
| Anna | test | 5 |
| John | test | 1 |

What I am trying to get is the following:

| name | sum(hit) | words\_count |
| --- | --- | --- |
| Bill | 6 | performance = 2 java = 0, test = 4 |
| Anna | 11 | performance = 5 java = 1, test = 5 |
| John | 7 | performance = 3 java = 3, test = 1 |

I could sum all hits and group by words and so but I only need one dataset each name.

I think I need a subquery or so. How can I get the `words_count` column in that way?

Actually I need it a Laravel controller to display it in a datatable but an SQl statement would help me a lot also.

Appreciate your help.

Answer: 
I saw the problem is you are using `uuid.v4()` in the render. So every time rerender, the `ListItem` become new and old state `isStrike` will lost.

You can make sure the key is unique and not change when rerender.

Here is a solution you can try: <https://codesandbox.io/s/spring-rgb-w45b3?file=/src/App.js>
You need to hold the striked list items in an array. Check the [codesandbox](https://codesandbox.io/s/crazy-browser-y1m3n?file=/src/ListItem.jsx)