Set custom value to store
Set custom value to store
Theme developers can set a custom value in redux store using fpi.custom.setValue('keyname', value)
and retrieve the value using the getter fpi.getters.CUSTOM_VALUE.
Example
import { useFPI, useGlobalStore } from "fdk-core/utils";
import { useEffect } from 'react';
export function Home() {
const fpi = useFPI();
useEffect(() => {
fpi.custom.setValue('userName', 'Theme devs')
fpi.custom.setValue('engineName', 'React')
}
}, []);
const CustomValue = useGlobalStore(fpi.getters.CUSTOM_VALUE);
console.log(CustomValue); // {userName: 'Theme devs', engineName: 'React'}
return (
<div className="home">
I am a home component
</div>
);
}