Buttons don't work with unity's new input system.

when I added button to my project(with new input system) it started throwing this error:

InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
UnityEngine.EventSystems.BaseInput.GetButtonDown (System.String buttonName) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/InputModules/BaseInput.cs:126)
UnityEngine.EventSystems.StandaloneInputModule.ShouldActivateModule () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/InputModules/StandaloneInputModule.cs:227)
UnityEngine.EventSystems.EventSystem.Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:474)

ikd how to fix

This is the 2D forum which has nothing to do with your post. So you know, the 2D forum isn’t for any feature problem you encounter when making a 2D game.

Here’s the ones related to your issue:
Input System
UI

You can find the available forums here.

EDIT: Moved to the Input System forum.

Simply click on the eventhandler in your hierarchy and there should be a button in the inspector to fix this.