응답에서 json 개체 추출

마지막 업데이트: 2023-12-05
  • 작성 대상:
  • Beginner
    Intermediate
    Developer

Headless 적응형 양식을 사용자 지정 제출 핸들러에 제출하면 제출 핸들러에서 반환한 데이터를 추출하여 React 앱에 표시할 수 있습니다. 다음 코드 조각은

// associate event handler for the onSubmitSuccess event
<AdaptiveForm mappings={extendMappings} onSubmitSuccess={onSuccess} formJson={selectedForm}/>
// extract the json returned by the custom submit service
const onSuccess=(action) =>{
        let body = action.payload?.body;
        let FirstName = JSON.parse(body.metadata.json).firstName;
        setThankYouMessage(FirstName+" your request has been received");

      }

이 페이지의