Stakes in newly public online companies — and those still planning IPOs — add risk to a portfolio, but the possibility of quick growth makes the lofty valuations more palatable.