Setup function is an abstraction of the utilities for testing. It can be rendering a component, mocks, user events and testing library utilities that help you grab an element from a DOM. It may also be database queries etc. This way, you can reuse the setup multiple times without having to use Testing Hooks.
Code Snippet - Setup Function