React with Native

Bringing together React and React Native

GitHub

README

React with native store

react-with-native-store (

OperationClassification

TODO: Ensure embedding this will embed the actual docs in my markdown renderer. I guess it might already do so!

TODO: It would be great to learn more about this topic and see if I can make more cross-environment packages. A great use case would be to create a wrapper around the current fs-orm to enable using it at the frontend too.

OperationClassification ui-cjs)

Api reference
createStore()

One function is all you need to make a new store!

Example:


import { createStore } from "react-with-native-store";
import { TypeA, TypeB } from "your-types";

export const writerInitialValues: {
itemA: TypeA;
itemB: TypeB;
} = {
itemA: "",
itemB: {},
};
export const { useStore, StoreProvider } = createStore(writerInitialValues);


Simple as pie 🍰

Input
-
Output{ StoreProvider: { },
useStore: { },
}
📄 createStore (exported const)

One function is all you need to make a new store!

Example:


import { createStore } from "react-with-native-store";
import { TypeA, TypeB } from "your-types";

export const writerInitialValues: {
itemA: TypeA;
itemB: TypeB;
} = {
itemA: "",
itemB: {},
};
export const { useStore, StoreProvider } = createStore(writerInitialValues);


Simple as pie 🍰

createUseStore()

Function to create a hook for accessing the store

Input
-
Output{ }
getItem()

If you don't have access to the useStore hook, maybe because you're doing something outside of react... you can directly use the storage with javascript using this function

Input
keystring
Output
📄 createUseStore (exported const)

Function to create a hook for accessing the store

📄 getItem (exported const)

If you don't have access to the useStore hook, maybe because you're doing something outside of react... you can directly use the storage with javascript using this function

createStoreProvider()

Function to create the StoreProvider

NB: this function uses a local variable on the main scope of javascript in order to create the Context components dynamically. Beware!

Input
-
Output{ }
📄 createStoreProvider (exported const)

Function to create the StoreProvider

NB: this function uses a local variable on the main scope of javascript in order to create the Context components dynamically. Beware!

Internal
Show internal (2)
setItem()

If you don't have access to the useStore hook, maybe because you're doing something outside of react... you can directly use the storage with javascript using this function

BEWARE! Updating this won't update your react components!

Input
keystring
Output
📄 setItem (exported const)

If you don't have access to the useStore hook, maybe because you're doing something outside of react... you can directly use the storage with javascript using this function

BEWARE! Updating this won't update your react components!