How to get react variable from useState in conect javascript API

Hi, here is my code

import React, { useEffect, useState } from "react";
import Select from "@atlaskit/select";

export default function OneValueShowConditionView({ }) {
  const [value, setValue] = useState(null);

  useEffect(() => {
    ...
    AP.jira.WorkflowConfiguration.onSave( ()=> {
      var config = {
        oneValueShowConditionValue: value, // × it doesn't work
      };
      return JSON.stringify(config); 
    });
  }, []);
  return (
      <Select
        id="single-select"
        name="customFieldId"
        inputId="single-select"
        className="single-select"
        classNamePrefix="react-select"
        options={options}
        placeholder="Choose a field"
        onChange={(newValue) => {
            console.log(newValue.id);
          setValue(newValue.id);
        }}
      />
  );
}

thanks for help