Need Help. How can I get result of function

Hi, can anybody help me with function? I`m work on small game like “guess the word”. In smart contact i have a function:

function guess(uint256 tokenId, string memory word) public payable returns (bool) {
require(msg.value == tryValues[tokenId], “Value should be equal to try value”);

    bool equal = keccak256(abi.encodePacked(word)) == wordHashes[tokenId];

    uint256 fee = msg.value * 5 / 100;
    _asyncTransfer(creatorAddress, fee);
    _asyncTransfer(ownerOf(tokenId), msg.value - fee);

    if (equal) {
        uint256 prizeFee = prizeValues[tokenId] * 5 / 100;
        _asyncTransfer(creatorAddress, prizeFee);
        _asyncTransfer(msg.sender, prizeValues[tokenId] - prizeFee);

    return equal;

I need to get result of guesstion from js react, how can i do it? Do I need to rewrite the function or can I do without it??

Hi you can send the result from your frontend or React to your contract when you call the guess function.

This is one way to do it with Moralis. Web3 Provider - Moralis