UNPKG

beautiful-react-hooks

Version:

A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development

14 lines (13 loc) 253 B
/** * Safely parse JSON string to object or null * @param parseString */ const safelyParseJson = (parseString) => { try { return JSON.parse(parseString); } catch (e) { return null; } }; export default safelyParseJson;