Title: How to use hooks create from @wordpress/hooks between multiple react application
Last modified: November 11, 2019

---

# How to use hooks create from @wordpress/hooks between multiple react application

 *  Resolved [varun286](https://wordpress.org/support/users/varun286/)
 * (@varun286)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/how-to-use-hooks-create-from-wordpress-hooks-between-multiple-react-application/)
 * Hi,
 * I would like to know about [@wordpress](https://wordpress.org/support/users/wordpress/)/
   hooks use. As using this package we can add hooks for filters and actions. These
   added hooks can be used within same react application. But, how to use these 
   hooks from different react applications.
 * Any kind of information regarding above will be appreciated.
 * Thanks & Regards
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhow-to-use-hooks-create-from-wordpress-hooks-between-multiple-react-application%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Darren Ethier (nerrad)](https://wordpress.org/support/users/nerrad/)
 * (@nerrad)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/how-to-use-hooks-create-from-wordpress-hooks-between-multiple-react-application/#post-12145690)
 * Hi [@varun286](https://wordpress.org/support/users/varun286/). Let’s see if I
   understand your question so far:
 * – you are wanting to know more about how the [@wordpress](https://wordpress.org/support/users/wordpress/)/
   hooks package works.
    – you understand it involves filters and actions. – you
   are unclear how to implement them.
 * Is this pretty much accurate so far? If so, let me clarify a few things:
 * This package doesn’t have any react dependency. The various interfaces exposed
   on that package can be used in any javascript environment.
 * Given the above, it sounds like you are having trouble with something specific
   in using the interfaces. Can you elaborate on what exactly you have tried and
   what isn’t working for you? Maybe that can help someone in the forums point you
   in the right direction for resolving your specific use-case?
 *  Thread Starter [varun286](https://wordpress.org/support/users/varun286/)
 * (@varun286)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/how-to-use-hooks-create-from-wordpress-hooks-between-multiple-react-application/#post-12145761)
 * Hi [@nerrad](https://wordpress.org/support/users/nerrad/)
    Thanks for the reply.
 * I have added some hooks(filters/actions) and I need to hook into these from different
   plugin.
 * I am able to add filter for applied filters within same plugin js file but not
   working when added from different plugin.
 * Here is code from main plugin –
 *     ```
       import React from 'react';
       import { Component } from '@wordpress/element';
       import { applyFilters } from '@wordpress/hooks';
       import { addFilter } from '@wordpress/hooks';
       import { useFilters } from '@woocommerce/components';
   
       export const TEST_FILTER = 'wk_test_filter';
   
       // addFilter( TEST_FILTER, 'plugin-domain', title => {
       //  return <code>Added to ${title}</code>;
       // } );
   
       export const titleFilter = applyFilters( TEST_FILTER, 'Default text' );
   
       class App extends Component {
           constructor( props ) {
               super( props );
           }
   
           render() {
               return (
                   <div>
                       <h1>{ titleFilter }</h1>
                   </div>
               );
           }
       }
   
       export default useFilters( TEST_FILTER )(App);
       ```
   
 * The commented code in above snippet is working fine but when I add the same filter
   from different react based plugin then it is not working anymore.
 * Regards
 *  [Darren Ethier (nerrad)](https://wordpress.org/support/users/nerrad/)
 * (@nerrad)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/how-to-use-hooks-create-from-wordpress-hooks-between-multiple-react-application/#post-12145901)
 * Usually what you are describing happens because of script loading order. You 
   have to make sure the script in your other plugin loads _before_ the `apply_filters`
   is invoked in your component.
 *  Thread Starter [varun286](https://wordpress.org/support/users/varun286/)
 * (@varun286)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/how-to-use-hooks-create-from-wordpress-hooks-between-multiple-react-application/#post-12222831)
 * Hi [@nerrad](https://wordpress.org/support/users/nerrad/) Thank you. It works.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How to use hooks create from @wordpress/hooks between multiple react 
application’ is closed to new replies.

## Tags

 * [hook](https://wordpress.org/support/topic-tag/hook/)
 * [wordpress hooks](https://wordpress.org/support/topic-tag/wordpress-hooks/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 4 replies
 * 2 participants
 * Last reply from: [varun286](https://wordpress.org/support/users/varun286/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/how-to-use-hooks-create-from-wordpress-hooks-between-multiple-react-application/#post-12222831)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
