0

hello i am now able to retrieve data from spreadsheets using tabletops

but now i need to match the user input to the array and if it matches it'll be a success

this is inside the render

const { data } = this.state
        const tabletopModel = data['token']
        const newData = tabletopModel ? tabletopModel.all() : null
        console.log('newData', newData)

this is inside the return()

{
    newData
        ? <div>

            <p>{newData[1].ID}</p>
            <p>{newData[1].氏名}</p>


        </div>
        : null
}

i tried doing this or hopefully it should like this??

 {
    if (row1.アドレス == document.getElementById('userEmail').value && row1.Passkey == document.getElementById('userPassword').value) {
        return (
            <div key={row1.ID}>
                <p>{row1.ID}</p>
                <p>{row1.氏名}</p>
                <p>{row1.アドレス}</p>
                <p>{row1.Passkey}</p>
                <p>{row1.token}</p>
            </div>

        )
    }
    else {

    }
}

1 Answer 1

2

Note: You shouldn't use document.getElementById(), because it works with the actual DOM and React might not re-render when there are changes in input.

What you should do is have an input field in your React code and a proper onChange handler for that input field, like here.

Then, you can write a handler like this:

onChangeHandler = (e) => { // do comparisons here or save input to state if(e.target.value === row1.data) { // do some stuff } };

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.