ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
23 lines • 1.15 kB
TypeScript
import { Location } from 'react-router-dom';
import { RaRecord } from '../types';
/**
* A hook that returns the record to use to override the values in a form
* @param options The hook options
* @param options.searchSource The key in the location search to use as a source for the record. Its content should be a stringified JSON object.
* @param options.stateSource The key in the location state to use as a source for the record
* @returns The record to use to override the values in a form
*/
export declare const useRecordFromLocation: (props?: UseRecordFromLocationOptions) => Partial<RaRecord<import("../types").Identifier>> | null;
export type UseRecordFromLocationOptions = {
searchSource?: string;
stateSource?: string;
};
/**
* Get the initial record from the location, whether it comes from the location
* state or is serialized in the url search part.
*/
export declare const getRecordFromLocation: ({ state, search }: Location, { searchSource, stateSource, }?: {
searchSource?: string | undefined;
stateSource?: string | undefined;
}) => Partial<RaRecord> | null;
//# sourceMappingURL=useRecordFromLocation.d.ts.map