Skip to content

Color pointer not resetting after color change #193

Open
@grantspilsbury

Description

@grantspilsbury

I am trying to reset the color pointer button after I click a button but the pointer remains the previously selected color.

In the example below I expect the color pointer to change to white (not green, and be in the correct position) after the Set button is clicked.

const Panel = () => {
  const [color, setColor] = useState('white')
  const handleColorChange = (color) => setColor(color)

  return (
	<>
	  <HexColorPicker color={color} onChange={handleColorChange} />
	  <button onClick={() => setColor('white')}>
	      Set
	  </button>
	</>
  )
}
export default Panel

What am I doing wrong?

Screen Shot 2022-09-13 at 9 00 51 am

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