从另一个组件获得onClick的价值[ReactJs]

我有两个组件,一个组件处理按钮,另一个组件是页面的索引。

页面的索引结构如下

const MainComp = () => {
    const [text, setText] = useState(' ')

    const test = [
        'One',
        'Two',
        'Three',
    ]

    return (
        <>
            <ChildComp onClick={() => test.map((i) => setText(i))} />  
        </>
    )
}

在按钮组件中,我有这个...

const ChildComp = ({ onClick }) => {
    const test2 = [1,2,3]

    return (
        <>
            <div>
                {test2.map((data) => (
                    <button onClick={onClick}>
                        {data}
                    </button>
                ))}
            </div>
        </>
    )
}

I want the value of each item in test2 to show up when the button is clicked.