Question: what are the test cases for capture screenshot in manual testing?

> 
> Capture screenshot
> 
> 
>

Answer: 
You can get the latest version of the state in the setState Method, where you then can add your object.

```js
const [data, setData] = useState({
    name: "",
    desc: "",
    sections: [],
 });

const newSection = {
    sectionName: "Hello",
    sectionDesc: "Desc",
    question: [],
};

const handleClick = () => {
   setData(data => ({
     ...data,
     sections: [...data.sections, newSection]
   })
 };

```

But I am actually not quite sure if you need the `...data` you might be able to leave that out.
The answer to you Updated Problem is:

```js
import "./styles.css";
import React, { useState } from "react";

export const CreateStepper = () => {
  const [data, setData] = useState({
    name: "",
    desc: "",
    sections: []
  });

  const SecondStep = (data: any) => {
    const [addSection, setAddSection] = useState(1);
    const newSection = {
      sectionName: "Hdsd",
      sectionDesc: "dsdsd",
      question: []
    };

    const handleClick = () => {
      setData({ ...data, sections: [...data.sections, newSection] });
    };

    return <></>;
  };

  return (
    <>
      <SecondStep data={data} />
    </>
  );
};

export default CreateStepper;

```

You could also provide SecondStep with the function via the Props If you prefer That this should work to:

```js
export default function CreateStepper() {
  const [data, setData] = useState({
    name: "",
    desc: "",
    sections: [],
  });

  console.log(data);

  return (
    <><SecondStep data={data} setData={setData} /></>)
}

function SecondStep(data: any, setData: (data : any) => void) {
  const [addSection, setAddSection] = useState(1);
  const newSection = {
    sectionName: "Hdsd",
    sectionDesc: "dsdsd",
    question: [],
  };

  const handleClick = () => {
    props.setData({ ...data, sections: [...data.sections, newSection] });
  };

  return (
    <Box>

    </Box>
  );
}

export default SecondStep;

```