Understanding CreateWithEqualityFnImpl In Zustand
createWithEqualityFnImpl is a function that creates a store with equality function, allowing for more control over re-rendering. It calls createStore and useStoreWithEqualityFn to create the store.
In this article, we will analyse how the createWithEqualityFnImpl is implemented by logging some of its value to get a better understanding. As you can tell from the above image, createWithEqualityFn calls the function createWithEqualityFnImpl. This pattern is used in vanilla.ts as well as demonstrated below: export const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl) as CreateStore createStore calls createStoreImpl and createWithEqualityFn calls createWithhEqualityFnImpl. Before we jump into the execution of createWi...