You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defmodule Parent do
slot default
...
def render(assigns) do
~F"""
<Context
put={__MODULE__, orientation: true}>
<Child><#slot /></Child>
</Context>
"""
end
Child
defmodule Child do
...
slot default
def render(assigns) do
~F"""
<div>
<#slot />
</div>
"""
end
Some other component
defmodule SomeComponent do
...
slot default
def render(assigns) do
~F"""
<Context get={Parent, orientation: orientation}>
<Parent>
{orientation} --> This has no value
</Parent>
</Context>
"""
end
In the example above, the orientation has no value. The solution is to define <Context put={}inside the child component as well.
SomeComponent should be able to access the values coming from the Parent component's context.
Your Environment
Surface: v0.7
LiveView: v0.17
Elixir: v1.13.1
The text was updated successfully, but these errors were encountered:
Nested slots cannot access parent Context values
Please see the code below
Parent
Child
Some other component
In the example above, the orientation has no value. The solution is to define
<Context put={}
inside the child component as well.SomeComponent should be able to access the values coming from the Parent component's context.
Your Environment
Surface: v0.7
LiveView: v0.17
Elixir: v1.13.1
The text was updated successfully, but these errors were encountered: