SolidJSS
SolidJSโ€ข9mo agoโ€ข
12 replies
Paul

React vs Solid wrt contexts

Lets say I have a component.

const Foo = (.....
<component Provider>
  <component />
</component Provider>
);

Foo.Bar = BarComponent.


In BarComponent I have

const ctx = useFooContext();


The problem here. Is that react follows a top to bottom strategy and will render out the components following the hierarchy. So FooProvider gets run first and the context is available.

Whereas with Solid, the BarComponent is then run first and then finds the context to be empty.

Is there any way to work around this?

I either want the BarComponent not be run:

Foo.Bar = BarComponent.


Or to delay it until the context is available.

Are there any solutions here? Thanks
Was this page helpful?