const norefresh = (e) => { e.preventDefault(); setCounter(counter + 2); }; ...something like code ... <button onClick={norefresh} className="search-button" type="submit"> Search </button>