Skip to content

AidaIssayeva/recomposition_examples

main
Switch branches/tags
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
 
 
 
 
 
 
 
 
 
 

Recomposition in Jetpack Compose

List of practical tips and code snippets to avoid unnecessary recomposition in Jetpack Compose.

This is an active repo, please contribute if you discovered useful tips related to recomposition.

The first 5 tips were part of the talk "What does Recomposition mean to your app" by me:

Depth Level Conference Slides
Light Connect Recharge'22 Link
Deep Droidcon SF'22 Link

📣 Don't forget to star or watch 👀 the repo to get updates!

🔥 List of tips:

  1. Break down composable functions as much as possible;
  2. Use the key composable;
  3. Read the state value at the lowest composable function;
  4. Use Modifier lambdas for every frequent changing state read in Modifier functions;
  5. Use derivedStateOf() to buffer the rate of changes;

to be continued...

📌 Contribution

Contributions are more than welcome! The more we learn together Jetpack Compose, the faster we'll climb that learning curve 💪.

Here are some contribution rules to follow:

  1. Give the good and bad examples of the same output (see: each Tip file contains GoodGreetings() and BadGreetings() composable functions);
  2. Add the recompose highlighter & counter to every composable function via Modifier;
  3. Add comments in the beginning of the file to give the overview of the tip, then in subsequent good and bad sections.

Here are some contribution steps to follow:

  1. Clone this repository;
  2. Branch out via git branch -b someBranchName;
  3. Open Android Studio (or any IDE you feel comfortable working with);
  4. Create a separate .kt file;
  5. Create a composable function, that starts with TipX(), where X = the last available number in the tip list + 1;
  6. Write your tip;
  7. Modify the README doc and include your tip to the list;
  8. Push your tip and open the PR here.

Thank you so much for contributing and helping others to learn 💚💚💚

Releases

No releases published

Packages

No packages published

Languages