Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[form-builder] Expose the withDocument HOC #126

Merged
merged 1 commit into from
Aug 22, 2017

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Aug 22, 2017

This exposes a higher order component that makes the current document available for any component in a form-builder context. By default, input components are not given the document, but there are cases you might want it, e.g. if you are a slug input that depends on another document field.

Example usage:

import {withDocument} from 'part:@sanity/form-builder'

function MyInput(props) {
  return (
    <div>
      Document title: {props.document.title}
      {/* ... */}
    </div>
  )
}

export default withDocument(MyInput)

@bjoerge bjoerge requested a review from rexxars August 22, 2017 09:39
Copy link
Member

@rexxars rexxars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants