Replies: 2 comments 1 reply
-
I really like the idea of simplifying things for developers working in this repo and believe that creating |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is fab, @JamieB-gu. The |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The concept of a
RenderingTarget
was introduced in #11239 to allow components to handle the different targets DCAR can render for. So far it has been used to represent two possible targets: "web" and "apps". Its value is, at present, made available through two different mechanisms:The config approach in (1) results in code that often looks something like this:
occasionally with:
included to prevent repetition in components where the condition needs to be checked several times.
Suggested Change
The above code could arguably be made a little easier to read and reason about, with less boilerplate, if we were to introduce a pair of components to abstract away the checks for the
RenderingTarget
:With this approach, developers would have to think less about context, create fewer intermediate variables, and write fewer conditional checks. Note that we only envisage this replacing mechanism (1) above, in most or all cases; mechanism (2), passing
RenderingTarget
via props, would remain unaltered.The purpose of this change would be to improve the developer experience, and therefore we would appreciate feedback from developers who work on DCAR. It's only worth doing if people will find it useful!
Alternatives
One alternative might be to use a single component and pass the
renderingTarget
as a prop:If anyone would prefer this approach, please comment! Likewise, if anyone would prefer different names for the components in either this or the proposal above, please suggest them.
Beta Was this translation helpful? Give feedback.
All reactions