State lawmakers passed nearly 20 laws this year that target ESG investing, a strategy that takes into account risks such as climate change.