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

Support for computed properties #54

Closed
wants to merge 1 commit into from
Closed

Conversation

fredvollmer
Copy link

This lets the developer pass a function for properties. This function will be called with the matched url, so that values can be computed dynamically based on URL.

This was referenced Jan 5, 2018
@tasti
Copy link
Owner

tasti commented Jan 6, 2018

This would be very fragile since it would eliminate the ability to use props that are functions for anything else.

However, this is how you can solve your use-case in v1.0.0:

const componentDecorator = (href, text, key) => (
  <a href={href} key={key} myComputedProp={computeSomething(href)}>
    {text}
  </a>
);

<Linkify componentDecorator={componentDecorator}>
  ...
</Linkify>

Any feedback is appreciated.

@tasti tasti closed this Jan 7, 2018
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