How can i share data between two plugins?

System Information
  • Strapi Version: 4.4.3
  • Operating System: ArchLinux 5.19
  • Database: PostgreSQL 14
  • Node Version: 16.17.0
  • NPM Version: not used
  • Yarn Version: 1.22.19

I have two plugins. One goes to the database and gets information. The second one creates a custom field. I want to pass data from a plugin that comes into the database to a custom field component. How can i do this?


I solved it by making a controller in the plugin. And making a request to the endpoint of a plugin inside another plugin.

  async function fetchCategory() {
    const url = "/{pluginUrl}/categories"
    try {
      const {data} = await axios.get(url)
      setCategoryData(data.results)
    } catch (err) {
      console.log(err)
    }
  }