Skip to content

State is not preserved between tabs #2

Open
@hfirst

Description

@hfirst

I added a checkbox to your Product Details tab. I check the box on. I then switch to another tab and then back again. The checkbox is now unchecked.

export function ProductGeneralTab() {

  const [checked, setChecked] = useState(false);

  const handleChange = () => {
    setChecked(!checked);
  };

  return ( 
      <div>
          <div>
            General
          </div>
          <div>
            <label>
              <input
                type="checkbox"
                checked={checked}
                onChange={handleChange} />
              My Value
            </label>

            <p>Is "My Value" checked? {checked.toString()}</p>
          </div>
        </div> 
      );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions