Passing layout and state to components