Wrapping tikz environment with savebox
The issue is that your box is only local. (If you are not familiar with the notions global and local, you may want to look at section 10 of TeX by topic, texdoc texbytopic
.) So you may want to make it global (or at least smuggle it out of the group). This can be achieved more easily with the environ
package.
\documentclass{standalone}
\usepackage{tikz}
\usepackage{environ}
\NewEnviron{tikzcomponent}[1]{\newsavebox{#1}%
\begin{lrbox}{#1}%
\begin{tikzpicture}
\BODY
\end{tikzpicture}%
\end{lrbox}%
\global\setbox#1\box#1% <- globalize the box
}
\begin{document}
\begin{tikzcomponent}{\abox}
\draw (0,0) -- (1,1) node {Hello world};
\end{tikzcomponent}
\usebox\abox
\end{document}