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

Inside: allow additional data to be passed #454

Merged
merged 2 commits into from Aug 13, 2019

Conversation

@bpierre
Copy link
Member

commented Aug 12, 2019

This is useful to pass some data from the parent component to the consumers.

Consumer:

// like before
const insideSomething = useInside('Something')

// pass true as a second parameter to get the optional data
const [insideSomething, somethingData] = useInside('Something', true)

Provider:

// data can take any value
function Something({ children }) {
  return (
    <Inside name="Something" data={{ hey: 'hey hey' }}>
      {children}
    </Inside>
  )
}

@bpierre bpierre requested review from AquiGorka and sohkai Aug 12, 2019

@bpierre bpierre referenced this pull request Aug 12, 2019
src/utils/inside.js Outdated Show resolved Hide resolved
@sohkai sohkai referenced this pull request Aug 13, 2019
47 of 83 tasks complete

@bpierre bpierre merged commit a107dc6 into newstyle Aug 13, 2019

3 of 5 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/travis-ci/push The Travis CI build could not complete due to an error
Details
License Compliance All checks passed.
Details
WIP Ready for review
Details
license/cla Contributor License Agreement is signed.
Details

@bpierre bpierre deleted the inside-data branch Aug 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.