Question: I am trying to reproduce this logic but using material-ui useStyle

```
<div className={'container ' + (state.unlocked ? 'containerUnlocked' : '')}>  

```

I imagined it would be something similar to this :

```
<div className={`${classes.container} + ${state.unlocked} ? ${classes.spacious} : ''`}>  

```

But it doesn't work.

Answer: 
The comments here have done a great job explaining why this doesn't work. Here's an elaboration a bit more on why the multiplication technique does work, and why the division technique doesn't.

Let's begin with multiplication. Suppose you want to compute 200 × 10. You could compute that by evaluating 200 × (9 + 1), or 200 × (8 + 2), etc. Each of those expressions is equivalent to the original one. Using the distributive property, this means we could compute 200 × 9 + 200 × 1 to get 200 × 10, or we could compute 200 × 8 + 200 × 2 to get 200 × 10, etc.

It just so happens that multiplying by powers of two happens to be done more easily by doing bitshifts. So, for example, we could compute 200 × 10 by evaluating

```
200 x 10 = 200 x (8 + 2)
         = 200 x 8  +  200 x 2
         = (200 << 3) + (200 << 1)

```

Now, can we do this for division? Well, it is indeed true that 200 / 10 = 200 / (8 + 2), same as before. But unlike multiplication, in the case of 200 / (8 + 2), we don't have a distributive property, so we cannot rewrite

> 
> 200 / (8 + 2) = (200 / 8) + (200 / 2).
> 
> 
> 

Therefore, we can't use the reverse of the bitshifting technique to quickly do the division.
I assume that efficiency is not a concern here, that it is just for fun (or a homework?).

As explained already, you cannot divide by 10 with bit shifting as easily as you can multiply by 10.

However, It is quite possible to use bit shifting for such a division, except that more shiftings are necessary.

For example, we can use the fact that `1/10 = 1/8 - 1/10 (1/4)`

Output:

```
3/10 = 0
12/10 = 1
128/10 = 13
1465/10 = 147
4566/10 = 457
5674/10 = 567

```

```
#include <stdio.h>
int div10 (int n) {
    if (n == 0) return 0;
    return (n >> 3) - div10(n >> 2);
}

int main () {
    int nums[] = {3, 12, 128, 1465, 4566, 5674};
    int n = sizeof(nums)/ sizeof(nums[0]);
    for (int i = 0; i < n; ++i) {
        int num = nums[i];
        int ans = div10(num);
        printf ("%d/10 = %d\n", num, ans);
    }
    return 0;
}

```