Skip to content

Instantly share code, notes, and snippets.

@kamescg
Created November 7, 2019 09:48
Show Gist options
  • Save kamescg/287a3e83d8dce98ecc4b9c14b43cc036 to your computer and use it in GitHub Desktop.
Save kamescg/287a3e83d8dce98ecc4b9c14b43cc036 to your computer and use it in GitHub Desktop.
/* --- Global Dependencies --- */
import React from 'react'
import PropTypes from 'prop-types'
import { BoxInject } from '3box-ui-state'
/* --- Local Dependencies --- */
import { Component, ListObjectValues } from '@horizin/ui-compose'
import { Effects } from '3box-ui-state'
/* --- Component --- */
const StorageRender = ({ box, ...props }) => {
const storage = Effects.useStorageRetrieveEffect(box, props)
return (
!storage.data
? null
: props.isList
? <ListObjectValues
data={storage.data}
pass={props.pass}
component={props.component}
/>
: Component(props.component, {
...storage.data,
...props.pass
})
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment