question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

question: passing t (or overriding namespaces) to child component

See original GitHub issue

Goal

We have a reusable Form which does validation message resolution. In most cases, it uses the validation namespace, but in some cases, the specific use case (e.g. SignInForm) may require a different message.

Old implementation

Prior to the removal of the HOC transFuncName, we created Form with a different translate function as a programmatic callback. This allowed the specific use case to pass in t, and if it was present in props, we used it for resolution.

New implementation

I’m not sure. I put the validation ns into the fallbackNS, but I still want the specific use case (e.g. SignInForm) to be able to pass an additional overriding ns to Form. What is the best way to achieve this on 6.0.x?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rosskevincommented, Sep 29, 2017

No problem, after some thinking and seeing the cases, I’m just going to pass an optional prop <Form tOverride={t}. I’ve found we have models that are effectively Person extends Contact, where we share a bunch of widgets. And we end up passing t down several levels, so I need to continue to pass t down in some way instead of the namespace I was originally thinking.

1reaction
jamuhlcommented, Sep 29, 2017

transFuncName was initially a good idea - but in the end lead to more problems than benefit (as it was not supported in the other components as those rely on having t passed through.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding parents namespace variable - Stack Overflow
I have come upon some code I can't figure out. In this situation, classes are not using self but rather class namespaces (no...
Read more >
Is there a way to Explicitly Namespace all Elements by default ...
Net Serialization features to include the Child element's namespacing ... I don't see how to override implicit namespacing default behavior.
Read more >
Specifying Namespaces for Elements and Attributes
In InterSystems IRIS XML support, you specify namespaces on a class-by-class basis. You use the NAMESPACE class parameter to specify the namespace for...
Read more >
Change default namespace associated to a folder when ...
We don't have the ability to associate metadata with a folder in CPS ... allows full namespace override; relative namespace: Child or ....
Read more >
XML Schema: Understanding Namespaces - Oracle
Moving to XML Schema? This introduction to namespaces will help you understand one of its more important elements.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found