As I delved into analyzing the codebase of zustand
, I stumbled upon this snippet in index.ts
:
export * from './vanilla'
export * from './react'
export { default as createStore } from './vanilla'
export { default } from './react'
Question arises regarding the purpose behind lines 3 and 4. My initial thought was to facilitate importing functions in different ways, such as:
import create from 'zustand'
or alternatively:
import { create } from 'zustand'
However, attempting the second method results in the error message:
Module '"zustand"' has no exported member 'create'. Did you mean to use 'import create from "zustand"' instead?
Clarification: I comprehend how to correctly import the create function. What baffles me is the intent behind including lines 3 and 4 in index.ts
. What implications does it have?