{"id":968,"date":"2026-01-31T11:53:51","date_gmt":"2026-01-31T11:53:51","guid":{"rendered":"https:\/\/nurlandroid.com\/?p=968"},"modified":"2026-01-31T11:53:53","modified_gmt":"2026-01-31T11:53:53","slug":"%d0%be%d0%b1%d1%8a%d1%8f%d1%81%d0%bd%d0%b8-%d0%b6%d0%b8%d0%b7%d0%bd%d0%b5%d0%bd%d0%bd%d1%8b%d0%b9-%d1%86%d0%b8%d0%ba%d0%bb-composable-%d1%84%d1%83%d0%bd%d0%ba%d1%86%d0%b8%d0%b8-%d0%ba%d0%be%d0%b3","status":"publish","type":"post","link":"https:\/\/nurlandroid.com\/?p=968","title":{"rendered":"\u041e\u0431\u044a\u044f\u0441\u043d\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b Composable-\u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 initial composition, recomposition, \u043a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0443\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438?"},"content":{"rendered":"\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u043c \u044d\u0442\u043e \u0431\u0435\u0437 \u043c\u0430\u0433\u0438\u0438: \u0443 \u043b\u044e\u0431\u043e\u0439 <code>@Composable<\/code> \u043f\u043e \u0441\u0443\u0442\u0438 \u0442\u0440\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0436\u0438\u0437\u043d\u0438:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u0412\u043e\u0448\u043b\u0430 \u0432 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e<\/strong> (initial composition)<\/li>\n\n\n\n<li><strong>\u0416\u0438\u0432\u0451\u0442 \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f<\/strong> (recomposition)<\/li>\n\n\n\n<li><strong>\u0412\u044b\u0448\u043b\u0430 \u0438\u0437 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438<\/strong> (disposed)<\/li>\n<\/ol>\n\n\n\n<p>Compose-\u0440\u0430\u043d\u0442\u0430\u0439\u043c \u043d\u0435 \u0434\u0430\u0451\u0442 <code>onCreate\/onDestroy<\/code>, \u043d\u043e \u0434\u0430\u0451\u0442 <strong>\u043f\u0440\u0430\u0432\u0438\u043b\u0430<\/strong>, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u044b.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. Initial composition \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u0445\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e<\/h4>\n\n\n\n<p><strong>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>setContent { MyScreen() }<\/code> \u0432\u043f\u0435\u0440\u0432\u044b\u0435<\/li>\n\n\n\n<li>\u0412\u043d\u0443\u0442\u0440\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 composable \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432\u044b\u0437\u043e\u0432 <code>Child()<\/code><\/li>\n\n\n\n<li>\u041f\u043e\u043c\u0435\u043d\u044f\u043b\u0441\u044f <code>if\/when\/navigation<\/code> \u0442\u0430\u043a, \u0447\u0442\u043e \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0434\u0435\u0440\u0435\u0432\u0430 \u0441\u0442\u0430\u043b \u043d\u043e\u0432\u044b\u043c<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n@Composable\nfun Screen() {\n    if (showDetails) {\n        Details() \/\/ &amp;lt;= \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435\n    }\n}\n<\/pre><\/div>\n\n\n<p><strong>\u0427\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 initial composition:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Compose \u0438\u0434\u0451\u0442 \u0441\u0432\u0435\u0440\u0445\u0443 \u0432\u043d\u0438\u0437 \u043f\u043e \u0434\u0435\u0440\u0435\u0432\u0443 <code>@Composable<\/code> \u0432\u044b\u0437\u043e\u0432\u043e\u0432.<\/li>\n\n\n\n<li>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430:\n<ul class=\"wp-block-list\">\n<li>\u0421\u043e\u0437\u0434\u0430\u0451\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 <strong>slot table<\/strong> (\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0434\u0435\u0440\u0435\u0432\u043e UI + remember-\u0441\u043b\u043e\u0442\u044b \u0438 \u0442.\u0434.)<\/li>\n\n\n\n<li>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 <code>remember { ... }<\/code> => \u043a\u043b\u0430\u0434\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043b\u043e\u0442\u044b<\/li>\n\n\n\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u0430\u0439\u0434-\u044d\u0444\u0444\u0435\u043a\u0442\u044b: <code>LaunchedEffect<\/code>, <code>DisposableEffect<\/code>, <code>SideEffect<\/code> \u0438 \u0442.\u043f.<\/li>\n\n\n\n<li>\u0421\u043e\u0437\u0434\u0430\u0451\u0442\/\u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 <code>LayoutNode<\/code>\/<code>DrawNode<\/code> (\u0442\u043e, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0438\u0441\u0443\u0435\u0442\u0441\u044f). <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u041f\u0440\u0438\u043c\u0435\u0440:<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n@Composable\nfun Counter() {\n    println(&quot;Counter composed&quot;) \/\/ &amp;lt;= \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u043e \u043d\u0430 initial composition \u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438\n\n    var count by remember { mutableStateOf(0) }\n\n    Button(onClick = { count++ }) {\n        Text(&quot;Count = $count&quot;)\n    }\n}\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>\u041d\u0430 <strong>initial composition<\/strong>:\n<ul class=\"wp-block-list\">\n<li><code>remember { mutableStateOf(0) }<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f => \u0432 slot table \u043a\u043b\u0430\u0434\u0451\u0442\u0441\u044f <code>MutableState(0)<\/code><\/li>\n\n\n\n<li><code>Button\/ Text<\/code> \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u0435\u0440\u0435\u0432\u0435<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">2. Recomposition \u2014 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/h4>\n\n\n\n<p><strong>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0422\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b <strong>\u043e\u0431\u0441\u0435\u0440\u0432\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/strong>, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u0432 composable:\n<ul class=\"wp-block-list\">\n<li><code>mutableStateOf<\/code>, <code>derivedStateOf<\/code><\/li>\n\n\n\n<li><code>collectAsState()<\/code>, <code>remember { mutableStateOf(...) }<\/code>, <code>rememberSaveable<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u0412\u043d\u0435\u0448\u043d\u044f\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0430 <code>State&lt;T><\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0438\u0442\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 composable.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n@Composable\nfun Counter() {\n    var count by remember { mutableStateOf(0) }\n\n    \/\/ \u043b\u044e\u0431\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 count =&gt; \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0434\u0435\u0440\u0435\u0432\u0430\n    Button(onClick = { count++ }) {\n        Text(&quot;Count = $count&quot;)\n    }\n}\n<\/pre><\/div>\n\n\n<p>\u041a\u043e\u0433\u0434\u0430 <code>count++<\/code>:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>MutableState<\/code> \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442 <strong>&#171;\u0447\u0442\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0435\u0439\u0442\u0430 => \u0431\u044b\u043b\u0430 \u0442\u0430\u043a\u0430\u044f-\u0442\u043e \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430<\/strong>&#171;<\/li>\n\n\n\n<li>\u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438: <code>state.value = new<\/code> => Compose <strong>\u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442<\/strong> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443.<\/li>\n\n\n\n<li>\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <strong>recomposition<\/strong>:\n<ul class=\"wp-block-list\">\n<li>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>Counter()<\/code><\/li>\n\n\n\n<li>\u041f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u0441\u043b\u043e\u0442\u044b \u0438\u0437 slot table<\/li>\n\n\n\n<li>\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0438\u043f\u043d\u0443\u0442\u044c \u0447\u0430\u0441\u0442\u0438, \u0433\u0434\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><strong>\u0412\u0430\u0436\u043d\u043e:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0420\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f <strong>\u043d\u0435 \u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d<\/strong>, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0438\u0442\u0430\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0441\u0442\u0435\u0439\u0442.<\/li>\n\n\n\n<li>\u0420\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 <strong>\u0431\u0430\u0442\u0447\u0438\u0442\u044c\u0441\u044f \u0438 \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f<\/strong>, \u043d\u0435\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u00ab\u043a\u0430\u0436\u0434\u044b\u0439 change => \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u00bb.<\/li>\n\n\n\n<li>\u0415\u0441\u043b\u0438 composable <strong>\u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u0442<\/strong> \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e <code>State<\/code>, \u043e\u043d \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438.<\/li>\n<\/ul>\n\n\n\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0435\u0439:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n@Composable\nfun Parent() {\n    val color by remember { mutableStateOf(Color.Red) }\n    Column {\n        Child1(color)      \/\/ \u0447\u0438\u0442\u0430\u0435\u0442 color =&gt; \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0442\u044c\u0441\u044f\n        Child2()           \/\/ \u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u0442 color =&gt; \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0438\u043f\u043d\u0443\u0442\u044c\n    }\n}\n<\/pre><\/div>\n\n\n<p>Compose \u0437\u043d\u0430\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u043a\u0430\u043a\u0438\u0445 <code>State<\/code>, \u0438 \u0434\u0435\u0440\u0433\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. Leaving composition \u2014 \u043a\u043e\u0433\u0434\u0430 composable &#171;\u0443\u043c\u0438\u0440\u0430\u0435\u0442&#187;<\/h4>\n\n\n\n<p>Composable <strong>\u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438<\/strong>, \u043a\u043e\u0433\u0434\u0430:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0435\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c (\u0432\u0435\u0442\u043a\u0430 <code>if\/when<\/code> \u0441\u0442\u0430\u043b\u0430 \u0434\u0440\u0443\u0433\u043e\u0439).<\/li>\n\n\n\n<li>\u041e\u043d \u0438\u0441\u0447\u0435\u0437 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 (<code>LazyColumn<\/code> \u0441 \u043a\u043b\u044e\u0447\u0430\u043c\u0438, <code>key {}<\/code> \u0438 \u0442.\u043f.).<\/li>\n\n\n\n<li>\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0443\u0448\u043b\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u044d\u043a\u0440\u0430\u043d \/ <code>setContent<\/code> \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n@Composable\nfun Screen(showDetails: Boolean) {\n    if (showDetails) {\n        Details()\n    }\n}\n<\/pre><\/div>\n\n\n<p>\u041a\u043e\u0433\u0434\u0430 <code>showDetails<\/code> \u0441\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0441 <code>true<\/code> \u043d\u0430 <code>false<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0412\u0435\u0442\u043a\u0430 \u0441 <code>Details()<\/code> <strong>\u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f<\/strong>.<\/li>\n\n\n\n<li>\u0414\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b <code>Details<\/code> \u0440\u0430\u043d\u0442\u0430\u0439\u043c:\n<ul class=\"wp-block-list\">\n<li>\u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0435\u0451 \u0438\u0437 slot table<\/li>\n\n\n\n<li>\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <code>onDispose<\/code> \u0443 \u0432\u0441\u0435\u0445 <code>DisposableEffect<\/code><\/li>\n\n\n\n<li>\u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 <code>LaunchedEffect<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0451<\/li>\n\n\n\n<li>\u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 <code>remember<\/code>-\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 <code>rememberSaveable<\/code> \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0441\u0442\u043e\u0440\u043e\u043c)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n@Composable\nfun Details() {\n    val state = remember { mutableStateOf(0) }\n\n    DisposableEffect(Unit) {\n        println(&quot;Details ENTER composition&quot;)\n        onDispose {\n            println(&quot;Details LEAVE composition&quot;)\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p>\u0412\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438: <code>Details ENTER composition<\/code><\/li>\n\n\n\n<li>\u043f\u0440\u0438 \u0441\u043a\u0440\u044b\u0442\u0438\u0438 <code>Details<\/code>: <code>Details LEAVE composition<\/code><\/li>\n\n\n\n<li>\u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438\u0437-\u0437\u0430 \u0441\u0442\u0435\u0439\u0442\u0430, \u0431\u0435\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e ENTER.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">\u0421\u0432\u044f\u0437\u043a\u0430 \u0441 remember \/ \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c\u0438<\/h4>\n\n\n\n<p><strong><code>remember<\/code><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u041d\u0430 initial composition: \u0431\u043b\u043e\u043a <strong>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f<\/strong>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u043b\u0430\u0434\u0451\u0442\u0441\u044f \u0432 \u0441\u043b\u043e\u0442.<\/li>\n\n\n\n<li>\u041d\u0430 recomposition: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0438\u0437 \u0441\u043b\u043e\u0442\u0430, <strong>\u0431\u043b\u043e\u043a \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f<\/strong>.<\/li>\n\n\n\n<li>\u041d\u0430 leaving composition: \u0441\u043b\u043e\u0442 <strong>\u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f<\/strong>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043e GC.<\/li>\n<\/ul>\n\n\n\n<p><strong><code>rememberSaveable<\/code><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u041f\u0440\u0438 leaving composition \u043c\u043e\u0436\u0435\u0442 <strong>\u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong> \u0447\u0435\u0440\u0435\u0437 <code>SavedStateRegistry<\/code> \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0440\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0438 (\u043d\u0430\u043f\u0440. \u0441\u043c\u0435\u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \/ recreate activity).<\/li>\n<\/ul>\n\n\n\n<p><strong><code>LaunchedEffect<\/code><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u041d\u0430 initial composition: \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430.<\/li>\n\n\n\n<li>\u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 <code>key<\/code>: \u0441\u0442\u0430\u0440\u0430\u044f \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 <strong>\u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f<\/strong>, \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f.<\/li>\n\n\n\n<li>\u041f\u0440\u0438 leaving composition: \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 <strong>\u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p><strong><code>DisposableEffect<\/code><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u041d\u0430 initial composition: \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <code>effect<\/code> \u0431\u043b\u043e\u043a, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <code>onDispose<\/code>.<\/li>\n\n\n\n<li>\u041f\u0440\u0438 recomposition:\n<ul class=\"wp-block-list\">\n<li>\u0435\u0441\u043b\u0438 key \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u2192 <code>effect<\/code> \u043d\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f<\/li>\n\n\n\n<li>\u0435\u0441\u043b\u0438 key \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u2192 \u0441\u0442\u0430\u0440\u044b\u0439 <code>onDispose<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, <code>effect<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u041f\u0440\u0438 leaving composition: \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 <code>onDispose<\/code>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u043c \u044d\u0442\u043e \u0431\u0435\u0437 \u043c\u0430\u0433\u0438\u0438: \u0443 \u043b\u044e\u0431\u043e\u0439 @Composable \u043f\u043e \u0441\u0443\u0442\u0438 \u0442\u0440\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0436\u0438\u0437\u043d\u0438: Compose-\u0440\u0430\u043d\u0442\u0430\u0439\u043c \u043d\u0435 \u0434\u0430\u0451\u0442 onCreate\/onDestroy, \u043d\u043e \u0434\u0430\u0451\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u044b. 1. Initial composition \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u0445\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442: \u0427\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 initial composition: 2. Recomposition \u2014 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-968","post","type-post","status-publish","format-standard","hentry","category-compose"],"_links":{"self":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=968"}],"version-history":[{"count":1,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/968\/revisions"}],"predecessor-version":[{"id":970,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=\/wp\/v2\/posts\/968\/revisions\/970"}],"wp:attachment":[{"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nurlandroid.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}