The Duke of Cambridge, who is on a two-day visit to New Zealand on behalf of the Queen, visited the mosque where 42 people died.