I'm not opposed to voting on EU membership in general, but the way the actual referendum was conducted was poor and it's increasingly clear that Russia attempted to interfere with it as well. Compare it to the Scottish referendum which was pretty well-conceived, the Brexit referendum looks amateurish in comparison. The reason is because it had very little to do with the government suddenly sprouting a love of participatory democracy, and everything to do with Cameron thinking that because he had won one referendum and ostensibly stopped the Scottish nationalists for a generation he could do the same to UKIP and the right of his own party.
In my view the vote should have been held, a democracy is only a democracy if it's allowed to make potentially harmful decisions for itself. However it should not have been rushed into being with zero regard for how it might test the constitution or what a leave vote actually meant, in my view the consequences of a leave vote should have been characterised and defined well in advance; all the debate between 'hard Brexit' or 'soft Brexit' should have happened before the date of the vote was set. It also should have been more credibly secured against Russian influence in light of the threats to democratic integrity that were new at the time, the government appears to have been genuinely lax on this front. They couldn't have carried it out in a more division-generating way if they'd been trying in my opinion, and it's because they rushed it for risky party-political reasons.
The keyword is "attempted". Its also clear they did not succeed in doing so