Frontity tutorial: Switch not defined

I’m working my way through the frontity tutorial. I’m fairly new to modern js frontend development.

I’m working through this tutorial page:

Specifically I’m working with this snippet of code:

This results in the error:
Uncaught (in promise) ReferenceError: Switch is not defined

That makes sense: I haven’t seen ‘Switch’ before, so I imagine it’s a component defined somewhere within the frontity framework.

If I google it I find it documented here:

So I’ve added this line to the snippet:
import Switch from "@frontity/components/switch";

Once this line is added, I get the outcome I want. The project compiles without a browser error.

This could be a stumbling block for people at around my level. I suggest that the documentation be updated with a little more detail. I suggest at least adding this line to the example code. Beyond that I suggest adding a little detail to the tutorial about the frontity components.


1 Like