Concept for Context Providers #52
CiberNin
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Something like a React context provider where you can provide a value in a parent component that is available to all the children.
I've actually gotten this sort of working with only a small change to syntax, although I have no idea at to performance.
TestIndex.jinja
Gets preprocessed into:
via this change to jinjax.py
Incidentally this _build_call appears to have an unneeded list comprehension when generating str_attrs.
And then I changed catalog.py so that you now use caller() like you would in a normal jinja macro instead of just content.
But I wrap it so that context is passed in & can be updated by keyword arguments.
TestOuter.jinja
catalog.py added lines to irender:
This is all meant to support creating some neat datagrid ideas I had where a single field component renders contextually depending on it's in a datagrid or a form or if the datagrid is editable or to reuse the field in both the header and the body of the table.
Beta Was this translation helpful? Give feedback.
All reactions