Skip to content

Releases: tylerdgenius/netwrap

Release list

v4.0.0

Choose a tag to compare

@tylerdgenius tylerdgenius released this 19 Jan 06:55

netwrap v4.0.0

Date: 2026-01-19

Highlights

  • New client entry point: netwrap/client for React hooks and client-only usage.
  • useFetcher hook for client components with loading/error/data state.
  • Clear split between server-safe utilities (netwrap) and client hooks (netwrap/client).

Deprecations

  • Using fetcher inside client components is deprecated. Use useFetcher instead.

Migration Notes

  • Update client components to import hooks from netwrap/client.
  • If you rely on fetcher in client components, plan to migrate to useFetcher.

API Summary

fetcher(options)

Returns:

  • trigger(triggerData?)
  • data
  • error
  • isLoading
  • getData()
  • getError()
  • getIsLoading()
  • onLoadingChange(listener)
  • onDataChange(listener)
  • onErrorChange(listener)
  • invalidateCache()

useFetcher(options)

Returns:

  • trigger(triggerData?)
  • data
  • error
  • isLoading
  • invalidateCache()

Notes

  • useFetcher must be imported from netwrap/client and used only in client components.
  • fetcher is not reactive; avoid destructuring data or error if you expect live updates.
  • fetcher cache is instance-local; recreate the instance to reset the cache.

v2.0.4

Choose a tag to compare

@tylerdgenius tylerdgenius released this 02 Feb 09:44

Built base for making and simulating data calls

In this release you have access to the function generators which enable you to simulate data calls as well as have live calls in your app when you import them into your app from the package.

This means you can do something like this

  // Define the hook configuration
  const hookConfig = {
    name: "myFetchDataHook", // Specify a name for your hook
    dataCallerType: "axios", // Set the DataCallerType to "axios"
    method: "get", // Specify the HTTP method (default: "get")
    url: "https://api.example.com/data", // Specify the URL

    /** Other optional props below can be included depending on your use case */
    requestData: { key: "value" }, // Include data to be sent in the request body (optional)
    signal: undefined, // Specify the AbortSignal object for canceling requests (optional)
    headers: { "Content-Type": "application/json" }, // Include HTTP headers (optional)
    onUploadProgess: (e: ProgressEvent) => {
      console.log("Upload Progress:", e.loaded);
    }, // Include a function to handle upload progress (optional)
  };

  // Call the hook generator with the hook configuration
  const { functions, loaders } = useFunctionGenerator(hookConfig);
  
    const handleGetData = async () => {
    try {
      const result = await functions.takeAction();
      console.log("Data:", result.payload);
    } catch (error) {
      console.error("Error:", error);
    }
  };
  
  ```javascript
  
  
Study the readme below to understand how to use this version properly. If you have any issues, kindly add them to this repo or fork the repo branch and raise a PR
  
[README.md](https://github.com/metrobuzz-com-ng/netwrap/files/14138237/README.md)

  
  ### Note 
  
  This will be removed once we move to version 3