Adding New Widgets
Embryo-ReactJS provides you the ability to add new widgets in the template. Please check the detailed documentation to learn, how to add the new widgets in the template.
Adding a new widget
Please follow the given steps to add a new widget in the template. We are taking an example of adding a "Blog Section" on the "Home Page Two" but you can add any widget on any of the pages in the template:
Step 1: Go to src->routes->home-two
& open the index.js
file and add the widget in the file like below. You can also add some styling to it, for this you can take the reference from other pages.
and import the widget at the top of the file like other import statements:
Step 2: Now you have to define a new state. This state is used to pass the data to the grid.
Step 3: Now you have to create a function to fetch the data from your database (in our case we are fetching the data from firebase) and pass it to the state defined in above step.
We need to import the firebase in our case.
Step 4: Call this function in the componentDidMount()
method.
Step 5: You have to conditionalise the return statement so that it will only return when your state have some data to show on the blog grid.
Once you have completed the above steps, you can now check the newly added widget on your Home Two Page like below:
Last updated