What happened

Shares in machine vision company Cognex (NASDAQ:CGNX) slumped 12.2% in December according to data provided by S&P Global Market Intelligence.

This capped off a dismal 2018 with the stock down more than 40% on the year. It had all looked so different at the start of the year, when CEO Rob Willett described market conditions as being the best the company had ever experienced. There was a real sense of optimism that the company would sign new deals in key end markets such as consumer electronics and logistics. Meanwhile, an improving global economy suggested that Cognex's customers would be in the mood to ramp up capital spending.

Unfortunately, by spring it had become clear that there would be a slowdown in spending from Cognex's OLED (organic light-emitting diode) and smartphone manufacturing customers -- incidentally, Apple (NASDAQ:AAPL) is Cognex's largest single customer, and consumer electronic represents around 40% of Cognex's business. Fast-forward to the third-quarter results, and investors were disappointed to hear about a broad-based slowdown in spending in China. 

In this context, and given the ongoing news of slowing economic growth in China -- notably in consumer electronics, where Apple blamed conditions in China for its poor first-quarter earnings -- it's not surprising to see the market sell off Cognex in December.

So what

It's difficult to discern whether the slowdown in China is largely a consequence of the ongoing trade dispute with the U.S. or has more to do with a natural slowing in the economy. In truth, the answer lies somewhere in between. The distinction matters because investors in Cognex will be hoping that a potential easing of trade tensions will lead to a new round of spending by its customers.

Whichever way you look at it, Cognex faces a near-term period of uncertainty due to China and consumer electronics. In addition, the automotive industry -- an early adopter of machine vision technology and one of Cognex's core markets -- is also facing slowing sales growth.

A map of the world with U.S. and China flags highlighted.

Image source: Getty Images.

Now what

Cognex's leadership in machine vision and its concomitant exposure to high-growth industries such as robotics and e-commerce make it the sort of stock that investors want to hold for the long term

However, no one said growth investing wouldn't come with hiccups along the way, and it's hard to ignore the near-term headwinds. It's definitely not a stock for the risk averse. That said, if trade tensions are eased by China complying with international norms over trade -- it's in everybody's rational interest to do so -- then Cognex's end markets could see some improvement. Investors should look out for more positive commentary from companies like Apple before feeling fully confident about 2019. 

Thinking longer term, Cognex's secular growth prospects aren't in doubt, and the weaker the stock gets, the more it will tempt growth investors looking for an entry point in an exciting long-term growth story stock.

Lee Samaha has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Apple and Cognex. The Motley Fool has the following options: long January 2020 $150 calls on Apple and short January 2020 $155 calls on Apple. The Motley Fool has a disclosure policy.