import React, { useState } from 'react'; import StyledWrapper from './StyledWrapper'; const RequestHeaders = () => { const [headers, setHeaders] = useState([{enabled: true}]); const addHeader = () => { let newHeader = { key: '', value: '', description: '', enabled: true, }; let newHeaders = [...headers, newHeader]; setHeaders(newHeaders); }; const handleHeaderValueChange = (e, index, menu) => { // todo: yet to implement }; const handleRemoveHeader = (index) => { headers.splice(index, 1); setHeaders(...headers); }; return ( {headers && headers.length && headers.map((header, index) => { return ( ) })}
KEY VALUE DESCRIPTION
handleHeaderValueChange(e, index, 'enabled')} /> handleHeaderValueChange(e, index, 'key')} /> handleHeaderValueChange(e, index, 'value')} /> handleHeaderValueChange(e, index, 'description')} />
) }; export default RequestHeaders;