'How to display the function result in the table after pressing the button?

I created a table, button and input using chakra ui. I want the function executed after "onClick" to display its result in a table. My main problem is the use of useState (). I'm not sure if I'm doing it right. There is no attempt to "enter" the function result into the table in the code. When I tried such solutions, the web application did not load. Please help

  Moralis.start({ serverUrl, appId, masterKey });

  const query2 = new Moralis.Query('SpaceMissionsStarted');

  const [inputValue, setInputValue] = useState('');

  const tableRow = document.getElementById('event');

  function findAddress() {
    const query2 = new Moralis.Query('SpaceMissionsStarted');
    query2.equalTo('senderAddress', inputValue);
  }

  return (
    <ChakraProvider theme={theme}>
      <Box textAlign="center" fontSize="xl">
        <TableContainer>
          <Table
            variant="striped"
            colorScheme="telegram"
            size="sm"
            mt={5}
            maxW="500px"
            ml={300}
          >
            <TableCaption>
              SpaceMission Started Events Query Finder
            </TableCaption>
            <Thead>
              <Tr>
                <Th>Event name</Th>
                <Th>into</Th>
                <Th isNumeric>multiply by</Th>
              </Tr>
            </Thead>
            <Tbody>
              <Tr>
                <Td>...</Td>
                <Td>...)</Td>
                <Td isNumeric>...</Td>
              </Tr>
              <Tr>
                <Td>...</Td>
                <Td>..</Td>
                <Td isNumeric>...</Td>
              </Tr>
            </Tbody>
            <Tfoot>
              <Tr>
                <Th>Event name</Th>
                <Th id="event"></Th>
                <Th isNumeric>..</Th>
              </Tr>
            </Tfoot>
          </Table>
        </TableContainer>
        <Input
          placeholder="address"
          maxWidth="300px"
          onChange={e => setInputValue(e.target.value)}
        />
        <Button
          colorScheme="telegram"
          ml={50}
          onClick={findAddress}
          id="button"
        >
          Find
        </Button>
      </Box>
    </ChakraProvider>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source