If you plan to run your component on J3 and J4 you till have occasion to need to do different things on each version. The following code can be used to wrap these different things:


       if (version_compare(JVERSION, "4.0", 'ge')) {

               // Do Joomla 4 stuff

       } else {

               // Do Joomla 3 stuff

       }