TanStack / form

🤖 Powerful and type-safe form state management for the web. TS/JS, React Form, Solid Form, Lit Form and Vue Form.

Home Page:https://tanstack.com/form

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to read properties in nested array table

KiaClouth opened this issue · comments

Describe the bug

I try to display some data in jsx but nothing appears
image

Your minimal, reproducible example

https://tanstack.com/form/latest/docs/framework/react/examples/array

Steps to reproduce

Insert {field.state.value["name"] + "ss"} at line 36

Expected behavior

show some text

How often does this bug happen?

Every time

Screenshots or Videos

image

Platform

  • OS: windows
  • Browser: chrome
    -framerwork: nextJs 14

TanStack Form adapter

react-form

TanStack Form version

v 0.19.2

TypeScript version

v5.1.6

Additional context

I have a more complex form locally, but the problem should be the same as mentioned here. I am not a professional front-end development engineer, I hope it is not my own problem

You're trying to access the wrong thing here. field.state.value is an array of objects. To access a value, you'll need to replace your interpolated JSX with:

{field.state.value[i].name}

Thank you very much, and sorry for wasting your time. I didn't realize this was the problem at all.hhh