Passing props to component
FormidablePencil opened this issue · comments
Problem
Passing a Vec I get the following error:
error[E0277]: the trait bound [UserBoughtStockHistoryInstance; 3]: IntoPropValue<Vec<UserBoughtStockHistoryInstance>>
is not satisfied
--> src\routes\investment_stats.rs:92:47
|
92 |
| ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait IntoPropValue<Vec<UserBoughtStockHistoryInstance>>
is not implemented for [UserBoughtStockHist oryInstance; 3]
| |
| required by a bound introduced by this call
|
This is because an array is passed to a property defined to accept a vector.
You need to pass a vector to this prop.
If your array is defined as [1, 2 ,3]
, you can change it to vec![1, 2, 3]
.
You can find a paragraph discussing whether you should use an array or a vector in the following page:
https://doc.rust-lang.org/stable/book/ch03-02-data-types.html#the-array-type
You can find the documentation about vector in the following page:
https://doc.rust-lang.org/stable/book/ch08-01-vectors.html