score:1
@inject('clockstore')
@observer
class app extends component<any, any> {
render(){
return <clock data={ mobx.tojs( this.props.clockstore.data } }></clock>
}
}
or
class clockstore {
@observable data = [
{id: "hour", value: "00"},
{id: "min", value: "00"},
{id: "second", value: "00"},
];
getdata(){
return tojs( this.data );
}
@action
update(id, value){
this.data.find(item => item.id === id).value = value;
}
}
@inject('clockstore')
@observer
class app extends component<any, any> {
render(){
console.log( 'app' );
return <clock data={this.props.clockstore.getdata()}></clock>
}
}
Source: stackoverflow.com
Related Query
- How to get to work mobx + react + ui components?
- How to get values from child components in React
- How to check when the react components get rendered or rerendered
- How to get MobX Decorators to work with Create-React-App v2?
- How to make React HOC - High Order Components work together?
- How to test react components with mobx observable state
- How to work with styled components in my react app?
- How to get React to work with Grunt and Babel?
- How does Express and React Routes work on initial GET request from browser?
- How to get Emotion styled component in a React project to work with TypeScript?
- How i can get suspense to work on react 18?
- How to get ESLint to work React + Babel in Sublime Text 3 editor?
- How to get Position of Components using React Function Components
- How to use styled components in React in order to get keyframe animations
- How to get my withStyles classes to work in my export class component in my React app
- How can click on button to get one of components with react
- How does a chained export work in react without the components in between actually rendering the component?
- How can I get combining from react beautiful dnd to work on my items?
- How Can I Get Form/Submit To Work with ReactStrap in a React functional component?
- How to get the data from Redux store using class components in React
- how to get two kinds of components structure in single react app
- How to get React preventDefault to work 'e.preventDefault();' not working
- How can i get setState to work in an event handler in a functional React component
- How to get Google Analytics to work with React
- How do I pass props to get a cancel button to work in React on a Redux-Form
- How can I get my product page to work on refresh with React -->Navigate?
- How to get value using components in React
- Mapping React Components into 'contentEditable' element. How to work around Node.removeChild error when a component is deleted via backspace?
- How to get onClick in React to work on a single element with multiple siblings?
- How to dynamically order my react components according to the order I get from my request?
More Query from same tag
- POST Fetch .Net Core
- Correct way to handle conditional styling in React
- Params in React Router v4 is not working correctly
- Can't see changes to react application When I update the code and rebuild the solution
- Dynamically store api response in a new array in reactjs
- changes material-ui checkbox state checked, unchecked or indeterminated based on other checkbox click, without using state in reactjs
- .map is returning only the last element of array React
- Handling 'Overlay Pages' with React Router?
- v16.6.0 or higher Context API not working when child is used in component that provides the context
- How to map React components but have 2 different sources of info
- Rendered more hooks than during the previous render. when posting form data with React Hooks
- Layout making multiple columns scrollable? CSS
- How can I import an existing React component defined in JSX in a Typescript module (.tsx)
- Why I get "Cannot read properties of undefined (reading 'map')" in React, while there is no syntax error
- React PureComponent vs Component in case of counts of rendering same
- How to make a declared module visible in Enzyme shallow render?
- Datetime filter for AG-Grid - Clear input text on button click
- how take second element from json
- Sanity.io GROQ - Retrive document by highest reference count in other documents
- react material ui populate table from API response
- Own time picker does not take the default value
- It is not possible to get props in react when using hooks
- React Native FlatList not rendering when data updates (Redux)
- MongoDB find vs findOne - find not working
- setState triggers child UseEffect with props as dependency
- How to use one class's method in react component?
- How to loop through json object data and split strings into variables
- React map is duplicating DOM Elements
- React conditional rendering simplified
- Manage the entire body in reactjs