question: passing t (or overriding namespaces) to child component
See original GitHub issueGoal
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:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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 effectivelyPerson extends Contact, where we share a bunch of widgets. And we end up passingtdown several levels, so I need to continue to passtdown in some way instead of the namespace I was originally thinking.transFuncNamewas 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 havingtpassed through.