Editing 4k H264 material can be difficult on almost any machine, depending on your expectations for responsiveness. I have edited 4k on a 2012 iMac 27 and it's possible but you ideally need proxies to make it smoother. FCPX supports that, so you just import with the FCPX>Preferences>Import>Create Proxies option enabled, or you select the clips after import, right-click and pick Transcode>Create Proxies.
After generating them, to use proxies you must set the Viewer to proxy mode -- it's in the drop-down menu at the upper right of the Viewer.