Reversible switch between bulk MgCO3·3H2O and Mg(OH)2 micro/nanorods induces continuous selective preconcentration of anionic dyes.