Views
Views are effectively React Functional Components combined with Oblong's dependency injection. Unlike the other parts of Oblong, Views do not need to be resolved to be used.
Hooks can be used, but class components are not supported.
#
Syntax#
View Name DuplicationIn the above example, you see MyView
twice, so you might want to eliminate the duplication. The string version supplied to the O.view(...)
function is indeed optional; this is perfectly valid: O.view()
.
The string version is used for React DevTools and error messages.
#
DependenciesThe .with({ ... })
call allows you to specify any dependencies your view has. These dependencies will be available as properties on the first argument supplied to your view body.
#
PropsProps can be used as the second argument:
#
Unit TestingTODO