I tried the code you posted. After clicking the save button, some prompts appear, but the printed information still does not show up anywhere. The cancel button’s event is also not triggered.
I added a console event to the cancel button as well, but it is still not being triggered.
// import { Page, Form, FormLayout, TextField, ButtonGroup, Button } from '@shopify/polaris';
// import React, { useState, useCallback } from 'react';
// export default function Settings() {
// const [tagsValue, setTagsValue] = useState('');
// const handleChange = useCallback(
// newValue => setTagsValue(newValue),
// [],
// );
// const handleSubmit = () => {
// console.log('Submitted tagsValue:', tagsValue);
// alert(123)
// }
// return (
//
// );
// }
import { Page, Form, FormLayout, TextField, ButtonGroup, Button } from '@shopify/polaris';
import React, { useState, useCallback } from 'react';
export default function Settings() {
const [tagsValue, setTagsValue] = useState('');
const handleChange = useCallback(
(event) => setTagsValue(event.target.value),
[],
);
const handleSubmit = (event) => {
event.preventDefault(); // Prevent default form submission behavior
console.log('Submitted tagsValue:', tagsValue);
// Implement submission logic here
}
const cancel = useCallback(
() => setTagsValue(""),
[],
);
return (
);
}
