The European grid has nothing to do with the EU. The grid includes non-EU countries like Switzerland and Norway. The UK did not leave the grid after Brexit; its interconnections with Ireland and the continent still exist.
The US and Canada's grids are interconnected without the two nations being integrated as closely as the EU member states are.