How to set material in geometry nodes (3.0) based on instance index

I don’t think this is the proper way to do it, but it appears to work. Maybe someone with more knowledge will show how to do it with primitives.