|
const addItem = (callback) => { |
|
let newState = stagedValue ? [...value, stagedValue] : value; |
|
setStagedValue(''); |
|
onChange(newState); |
|
}; |
In Voices' page component Metadata.jsx, there appears to be logic that assumes that:
- a user might enter a value into the
ListInputBox component but not click Add Item and
- we want to commit and use the staged value upon form submission
Therefore, Metadata.jsx creates a ref and passes it into ListInputBox (ListInputBox is still a class component in Voices). Metadata then uses the addItem method on the ListInputBox component via the ref to commit any staged values upon form submission.
Now that ListInputBox is a functional component, ancestors can no longer access its "methods" and logic like what I described above will have to be reimagined.
This issue prompted by this discussion.
Solon/src/components/form/ListInputBox.jsx
Lines 27 to 31 in ac30a1c
In Voices' page component
Metadata.jsx, there appears to be logic that assumes that:ListInputBoxcomponent but not clickAdd ItemandTherefore,
Metadata.jsxcreates a ref and passes it intoListInputBox(ListInputBoxis still a class component in Voices).Metadatathen uses theaddItemmethod on theListInputBoxcomponent via the ref to commit any staged values upon form submission.Now that
ListInputBoxis a functional component, ancestors can no longer access its "methods" and logic like what I described above will have to be reimagined.This issue prompted by this discussion.