You will hear that the 7700k is "better" than Ryzen R7, and that it "beats" the R7 range. However, while true, that is not all of the truth.
First point is that the 7700k only gives you higher FPS if you are CPU bound and in high fps range. That translates to worst case 10-20fps difference in the average range roughly above 120fps(ballpark figures). So it has more fps in one specific scenario. If you set details to a point where it brings you below that range, then there is no difference between these two CPUS. Notice that the reviews that show that slim margins in the frame differences are with 1080ti and Titan xp in 1080p.
Second point, the R7 range gives you the fps it does with power to spare, while the 7700k gives you the extra few fps and is peaked to full load, which means it has no power to spare. So if you eliminate the GPU, the frame rate that your see from the 7700k is at its peak, it won't go higher in future and as a matter of fact if games get more CPU heavy it can go down, but for the R7 it can only go higher as there is power to spare.
Third, the reviews are done in benchmarking environment, which means a clean install of windows and no background tasks, that works heavily in favour of the 4 core 7700k but in reality, you won't be in that situation, which reduces the already slim margin between R7 and the 7700k in the high fps range.
Conclusion, you should only buy the 7700k if you are purely gaming, and have a high end GPU and high refresh 1080p monitor for 144hz+ gaming and that 10-20fps difference in the already high fps range of roughly about 120+ matters to you. You should also use a clean install of windows with no background tasks running as it might occasionally bring you down to the R7 fps range, since the margin is not that wide anyway.
In any other case, for example a 1440p 144hz gaming system, having some background tasks running, doing other tasks occasionally,... it is worth trading that few fps in the high fps range for the raw computational power available in R7.